I’m working on an ASP.NET project for a school. In one area I want to be able to serve up almost identical views for staff and students – the only real difference is the data that gets shown.
For a user with a student role they should see only their own data whereas a teacher should be able to see the combined data of their class (plus dive into see a single students data). Both users are able to flip between a couple of partial views that represent the data differently (line graph, table, etc.)
What is the best practice for structuring this using the MVC pattern?
Essentially it will be the same view for all of them, only the info I’m fetching will be different. I’ve read some other questions on here about two controllers and one view but they don’t seem to have the same permission requirements I have.
Looks like there is a pretty good answer on SO already asp.net mvc – dynamic controller based on authenticated user. This basically allows you to create different controllers based on authentication. You can make this even easier by separating the visual representation of data into different partial views stored in the shared directory so that the different controllers’ views can use the same partial views to serve up html.