MVC using Razor
Let's explore the first type of application, the classic server-rendered web user interface. In this kind of application using MVC, you divide the application into three distinct parts, where each has a single responsibility:
- Model: The model represents a data structure, a representation of the domain that we are trying to model.
- View: The view's responsibility is to present a model to a user, in our case, as a web user interface, so mainly HTML, CSS, and JavaScript.
- Controller: The controller is the key component of MVC. It plays the coordinator role between a request from a user to its response. The code of a controller should remain minimal and should not include complex logic or manipulation. The controller's primary responsibility is to handle a request and dispatch a response. The controller is an HTTP bridge.
If we put all of that back together, the controller is the entry point of every request, the view composes the response...