asp.net mvc - Using one controller or multiple controllers for a navigation page menu -
i've noticed sites use separate controller each menu item on navigation page. here example
if have menu on page looks this
- messages
- profile
- inbox
- items purchased
when each item gets clicked takes me new controller though still see menu @ top of page ex.
www.somepage.com/messages www.somepage.com/profile www.somepage.com/items purchased
is there advantage having different controller, above, each item in menu. i'm trying weigh advantages of having multiple controllers here vs 1 controller different actions below , i'm kinda newbie mvc
is better? 1 controller(menu) multiple actions show different areas of menu
www.somepage.com/menu/messages www.somepage.com/menu/profile www.somepage.com/menu/items purchased
one last thing keep in mind want have sub menu items in menu/messages want incoming/outgoing, how look?
www.somepage.com/menu/messages/incoming www.somepage.com/menu/messages/outgoing
or better have
www.somepage.com/messages/incoming www.somepage.com/messages/outgoing
it's kinda preference, think standard different controllers.
different controllers gives default seperation, , if you're using default routes works nicely if want add on sub-menus.
www.somepage.com/profile -- standard profile page www.somepage.com/profile/edit -- edit profile page nice route
of course same thing if had them in menu controller, routes bit messy, or have define how want them in route config manually.
advantages having them in 1 controller have 1 place look/maintain when editing specific actions (shrug).
personally different controllers each mini 'section', because produces nice seperation, default routing pretty decent , each controller can have different dependencies.
Comments
Post a Comment