An MVC model contains all of your application logic that is not contained in a view or a controller. The model should contain all of your application business logic, validation logic, and database access logic. For example, if you are using the Microsoft
Entity Framework to access your database, then you would create your Entity Framework classes (your .edmx file) in the Models folder.

A view should contain only logic related to generating the user interface. A controller should only contain the bare minimum of logic required to return the right view or redirect the user to another action (flow control). Everything else should be contained
in the model.

In general, you should strive for fat models and skinny controllers. Your controller methods should contain only a few lines of code. If a controller action gets too fat, then you should consider moving the logic out to a new class in the Models folder.

MVC architectural pattern follows an elementary idea – we must separate the responsibilities in any application on the following basis:

Model: Handles data and business logic.

View: Presents the data to the user whenever asked for.

Controller: Entertains user requests and fetch necessary resources.

The controller asks the model to return the list of available pens (2).
Now, the model searches the database for the necessary information (3), applies logics if necessary, and returns the data to the controller(4)

<end>

If you find the post has answered your issue, then please mark post as 'answered'.

So,you only need to define it once in the controller,and call it once in Layout.

Best Regards.

Yuki Tao

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

I suggest you could google something about dynamic menu in mvc,This requires a suitable database design to serve complex menus.

Best Regards.

Yuki Tao

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.