Data sent to Model Clean when changing Page?

Asked

Viewed 20 times

0

A question that came to me now, based on this post: Building Customizable ASP.NET MVC Menu

If I popular my model of Menuitem when the user logs in, it will popular, for example, with the following "modules":

-Products

-Customers

-Users

I would be making this "population" of Model in my controller of Login. When I go to another action from another controller, for example the action Cadastra controller’s Users, my model of Menuitem will be emptied and will have to popular it again, or it will continue filled with the modules already filled?

1 answer

1


No need to pass the menu model to each screen.

Normally the menu is loaded in the layout or by a partialview, so every time you change page, there will be the menu load.

  • So basically using a Layout, if I press this Layout my model, and use this layout in the other actions of other controllers, my Layout would already be loaded, that’s right?

  • 1

    Exactly. The layout is the basis of the screen.

  • 1

    Show! Thank you so much man!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.