MVC is a design pattern used to decouple user-interface (view), data (model), and application logic (controller). This helps to achieve separation of concerns.
Using the MVC pattern for websites, requests are routed to a Controller which is responsible for working with the Model to perform actions and/or retrieve data. The Controller chooses the View to display, and provides it with the Model. The View renders the final page, based on the data in the Model.
The Model in an MVC application represents the state of the application and any business operations and logic that should be performed by it. Business logic should be enclosed in the model, along with any implementation logic for persisting the state of the application. Views typically use ViewModel types designed to contain the data to present on that view. The controller creates and populates these ViewModel instances from the model.
Views are responsible for presenting content through the user interface. They use the Razor view engine to embed .NET code in HTML markup. There should be minimal logic within views, and any logic in them should relate to presenting content.
Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. In the MVC pattern, the controller is the initial entry point, and is responsible for selecting which model types to work with and which view to render. In short, controller controls how the app responds to a given request.
Synthesis Technology is a leading ASP.NET MVC development company. Hire .
Partner with Us