In the context of MVC, what is the primary role of the ViewModel?
- To represent the database model
- To handle user authentication
- To manage routing and navigation
- To pass data from the controller to the view
The primary role of the ViewModel in MVC is to pass data from the controller to the view. It acts as an intermediary between the controller, which retrieves and processes data, and the view, which displays it. This separation helps keep the presentation logic clean and testable.
Loading...
Related Quiz
- In ASP.NET Core Identity, the _________ option can be used to enforce password histories, ensuring users don't reuse recent passwords.
- When you want to use a namespace across multiple Razor views without adding it to each view, where should you define it?
- In an MVC project, where would you typically place business logic or data access logic?
- How does Entity Framework Core handle database migrations?
- When dealing with complex forms in Razor, which approach allows for grouping related form fields into smaller, reusable views?