learning mvc and building a full blown ecommerce app.
Administrators should be able to add-edit whatever they like.
Let’s take an example Employees.
I have added an Area called “Admin”.Within admin I have Employees
In here an administrator should be able to add-edit info about employees.
Now in the user section the user should not be able to add-edit.etc..
At them moment I have 2 controllers?
- Areas-Admin-Controllers-EmployeeController
- Areas-Aboutus-Controllers-EmployeeController
It does not seem right to me.How do you handle such a code repetition?
I would like to have only one controller.How do you structure your mvc app in this case?
any example I can download?
Looking for a good examples where you can see areas working and running themes dynamically etc..
thanks for any suggestions
You could use a single
~/Controllers/EmployeesControllercontroller to handle theEmployeeresource in your application. Inside this controller actions that require administrative (or some logged in user) privileges could be decorated with the[Authorize]attribute by specifying the required roles in order to execute this action: