ASP.NET MVC Framework is a framework for creating web applications that implements the Model-view-controller template.
The ASP.NET MVC platform is based on the interaction of three components: a controller, a model, and a view. The controller receives requests, processes the user input, interacts with the model and the view, and returns the result of the request processing to the user.
The model represents a layer that describes the logic of data organization in the application. The view receives data from the controller and generates user interface elements to display information.
The ASP.NET MVC platform is an alternative to the ASP.NET web form schema when creating Web applications. The ASP.NET MVC platform is a lightweight display platform with extensive testing capabilities and, like application-based Web forms, is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC platform is defined in the System.Web.Mvc assembly.
VC is a standard development template, familiar to many specialists. Some types of web applications have advantages when creating on the MVC platform. For others, it may be advisable to use a traditional ASP.NET application framework based on web forms and postback. In some cases, a combination of two approaches is possible: the use of one scheme does not exclude the use of another.
The MVC platform includes the following components.
Models. Model objects are parts of the application that implement logic for the application data domain. Model objects often receive and store the state of the model in the database. For example, the Product object can receive information from the database, work with it, and then write the updated data to the Products table of the SQL Server database.
In small applications, this model implies a conceptual rather than a physical separation. For example, if an application only reads a dataset and sends it to the view, then the physical layer of the model and the associated classes are missing. In this case, the data set assumes the role of the model object.
Representation. Views serve to display the user interface of the application. The user interface is usually created based on the model data. An example is the view for editing the Products table, which contains text fields, drop-down lists, and check boxes whose values are based on the current state of the Product object.
Controllers. Controllers interact with the user, work with the model, and select a view that displays the user interface. In an MVC application, views only display data, and the controller processes the input data and responds to user actions. For example, a controller can process string values of a query and pass them to a model that can use these values to send a query to the database.
The MVC template allows you to create applications, various aspects of which (input logic, business logic and interface logic) are separated, but interact closely enough with each other. This diagram indicates the location of each kind of logic in the application. The user interface is located in the view. The input logic is located in the controller. Business logic is in the model. This separation allows you to work with complex structures when creating an application, as it provides simultaneous implementation of only one aspect. For example, a developer can concentrate on creating a view separately from the business logic.
The link between the main components of the MVC application also facilitates parallel development. For example, one developer can create a view, another one is the logic of the controller, and the third is the business logic of the model.