This question can be related to any MVC Framework.
How do you organize your controllers in MVC application?
Lets say I have a Blog application. This blog application would have 2 layers.
Blog layer that shows latest 10 posts, single post, posts by category etc.
And I would have Admin layer that would enable user to create new blog post, edit post, delete post, create category…
How would I build my controllers?
Should I create Blog Controller and Admin Controller?
Or should I fallow Domain Driven Design and create BlogController, PostController that would deal with actions related to that Object?
The question is how to organize your controllers, should Controllers be something like “namespaces” for related functionality? So Administration functionality would have Admin controller that would deal with create, update, delete actions, and Blog Controller would deal with showing those posts to the end user?
I hope you get what I need, explanation on how to organize your Controllers in MVC?
I think there is no ‘better way’ to do this. You can organize your controllers the way you find easier. In fact you could use a single controller for both Blog layers without problems or performance loss.
That said, in my projects I prefer to use two controllers (like in your first approach), so I can set up authentication per controller (no need to do it per action). But it is a matter of preference.