I am using ASP MVC 4 framework. For example, I have 2 controllers: MainPanelController and CartController.
MainPanel controller defines methods and views for showing base main panel functions. Cart controller for example defines standard cart methods: RemoveFromCart, ClearCart, AddItemToCart etc.
Where should I define ShowCartItems method, if I want to display cart items list in main panel index page? I have two choises:
- in CartController as PartialViewResult and render it in Index View of
MainPanel controller - completely define it in MainPanelController
I think showing cart items is CartController’s task. Or maybe should I define ShowCartItems view in MainPanelController?
Maybe what your are looking for is
RenderActionmethod, which provides you a way to output an action from other controller: