I have a question about how to design my controllers properly.
Project is fairly simple: blog, immage gallery with categories and images inside them, news secion.
However I don’t know how to organize my controllers for this because I want to make somewhat admin panel where administrators can edit, add and modify these things. I’ve came up with 3 scenariosu so far…
-
Admin panel will have links to
site/controller/edit, but layout for these action results will be different from standard one. -
Admin controller will have all these actions like BlogAdd, BlogEdit so that url will be something like
/site/admin/blogedit. -
Create copies of Blog controller in admin folder so url will be like
/site/admin/blog/edit– i sense problems with routing since 2 controllers with same name does not sound like a good idea, however I like ho URL looks in this situation.
What I’m trying to make is CMS somewhat similar to wordpress, where blog creation,editing and deletion is completely separated from default blog itself.
You can create Areas in your MVC project and have your admin functionality in a controller in your admin area.
This will allow you to easily seperate your administration functionality from your general blog functionality.
That’s how I’d do it.