I’ve four kinds of user (Customer, Admin, Manager, teacher) that can use my future ASP Web Site… And so for each of them I have to create different interfaces…
And so my questions:
-
Is this correct to use different Layout in MVC 3 ? If not what can I use for my problem ?
-
If it’s correct how to use different layout in MVC 3 ? Can you give me one or more example please ?
You can show the pages in different ways by testing what kind of user it is
In my _Layout.cshtml i have this:
And so on.
You could create different DisplayTemplates for each kind of role and display these based upon which role the user has.
To manually assign Roles to different users, use ASP.NET Configuration
From there, you can create your roles and manage users.
You do not want to do this in the long run, if you get a lot of users on your site. Instead, when they create an account, you would want to assign their role automatically.
You can do this in your AccountController, for instance like this:
Your model could have the Role property instead of hardcoding it.