Should I split Admin area by adding a controller per entity? Or is it better to have no areas at all and to have admin controller with authorization attribute applied?
Need an advice. How is that implemented in real world projects?
I've seen different views used for the "admin case." Aka...if loggedIsUser.isAdmin? show edit controls. After all, admin responsibilities include full crud of your resources, so your controller will already have all the possible CRUD actions - it would just be a matter of authorizing the user to use those actions. This would be done in two steps: 1.) show the admin controls on the page if the user is an admin 2.) allow the admin to access privileged controller actions.
This scheme is also really good for code reuse as you're sharing UI elements between two views.
You aren't forced to use the default MVC routes. Create your own that will take the areas/admin/ url and forward it to the areas/admin/home/index request.
Since Home is the default controller and index is the default action name, going to /admin is the same as /admin/home/index
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.