I'm trying to use _layouts for a shop site.
Every page has different data with only the left menu data being common. It seems I'm being forced to have a gigantic global model with every possible bit of data represented in it. e.g ShopModel.menu,ShopModel.category,ShopModel.footer,ShopModel.category leader etc. It just goes on forever and gets very deep an complicated.
Is there no way to separate the code so that the menu handles the menu and the category handles the category etc. Seems like a big backward step from Web forms. I tried a _partial with its own @model for the menu but it seems its ignored and the CHTML is still looking for data in the main ShopModel.
Of course on day one I tried adding multiple @models to the page but that doesn't work.
Edit: Unfortunately, I must not explain it very well as I would see this as a first-day problem. I would expect the _layout to contain the MENU @model as its common. I would then expect to add my CATEGORY @model to the index page as it loops Categories in a foreach.
The Html is fine. I know how to add a partial but how do I add a self-sufficient partial with dynamic foreach data for example.?