Core
Core
NET CORE
• The Model-View-Controller (MVC) pattern helps make your web APIs and
web apps testable.
• Razor markup provides a productive syntax for Razor Pages and MVC
views.
• Tag Helpers enable server-side code to participate in creating and
rendering HTML elements in Razor files.
• Built-in support for multiple data formats and content negotiation lets
your web APIs reach a broad range of clients, including browsers and
mobile devices.
• Model binding automatically maps data from HTTP requests to action
method parameters.
• Model validation automatically performs client- and server-side validation.
Client-side development
• Models: Classes that represent the data of the app. The model classes use validation logic to
enforce business rules for that data. Typically, model objects retrieve and store model state in a
database. In this tutorial, a Movie model retrieves movie data from a database, provides it to the
view or updates it. Updated data is written to a database.
• Views: Views are the components that display the app's user interface (UI). Generally, this UI
displays the model data.
• Controllers: Classes that handle browser requests. They retrieve model data and call view templates
that return a response. In an MVC app, the view only displays information; the controller handles
and responds to user input and interaction. For example, the controller handles route data and
query-string values, and passes these values to the model. The model might use these values to
query the database. For example, http://localhost:1234/Home/Abouthas route data of Home (the
controller) and About (the action method to call on the home
controller). http://localhost:1234/Movies/Edit/5 is a request to edit the movie with ID=5 using the
movie controller. We'll talk about route data later in the tutorial.
• The MVC pattern helps you create apps that
separate the different aspects of the app (input
logic, business logic, and UI logic), while providing
a loose coupling between these elements. The
pattern specifies where each kind of logic should
be located in the app. The UI logic belongs in the
view. Input logic belongs in the controller.
Business logic belongs in the model. This
separation helps you manage complexity when
you build an app, because it enables you to work
on one aspect of the implementation at a time
without impacting the code of another.
Lets create a MVC project
• The process of creating a MVC project using
ASP.NET Core will look something as below:
Create a solution
Pick up templates
Solution Explorer with a Core 2.1 MVC
project
Application startup in ASP.NET Core