MVC Architecture
Understand the Model-View-Controller pattern that ASP.NET Core MVC is built around.
What is MVC?
Model-View-Controller is an architectural pattern that separates an application into three interconnected parts, each with a distinct responsibility — making applications easier to test, maintain, and extend.
Model
The Model represents your application's data and business logic — typically a plain C# class representing a database entity or a piece of domain data.
View
The View is responsible for presentation — the HTML (via Razor) shown to the user, built from data the controller provides.
Controller
The Controller receives incoming requests, coordinates with models (and services) to gather data, and chooses which view to return.
How They Work Together
Model
What the data looks like.
View
What the user sees.
Controller
What happens when a request comes in.
FAQs
Yes — API controllers follow the same Controller concept, just returning JSON data instead of an HTML View.
Summary
- MVC separates data (Model), presentation (View), and request handling (Controller).
- This separation makes applications easier to test and maintain.
- API controllers use the same pattern, returning JSON instead of HTML.