5.2. The ASP.NET MVC Platform

The ASP.NET MVC platform is a framework for creating websites and web applications on the model-view-controller (MVC) pattern. The concept underlying the MVC pattern breaks down an application into three parts:

Controller

Controllers work with the model and provide interaction with the user. They also provide view options for displaying the user interface. In an MVC application, views only display data while the controller handles the input and responds to user activities.

As an example, the controller can process string values in a query and send them to the model, which can use these values to send a query to the database.

View

the visual part of application’s user interface. The user interface is usually created to reflect the data from the model.

Model

Model objects are the parts of the application that implement the logic for working with the application data. Model objects typically receive the status of the model and save it in the database.

5.2.1. Model-View-Controller Interaction

Interaction between these components is illustrated in the following general diagram:

fbdevgd30 mvc 001 en

Figure 29. Interaction between M-V-C parts

The MVC pattern supports the creation of applications whose logical aspects — input, business and interface — are separated but interact closely with one another. The diagram illustrates the location of each logic type in the application:

  • the user interface in the view

  • the input logic in the controller

  • the business logic in the model

This separation allows you to work with complex structures while developing the application because it ensures discrete implementation of each aspect. The developer can focus on creating a view separately from implementing the business logic.

More comprehensive information about the ASP.NET MVC technology can be found at the website of the ASP.NET community.