Model-View-Controller (MVC)
noun
say it: “EM-VEE-SEE” /ˌɛm viː ˈsiː/
A way of building web apps that splits them into models for data, views for HTML and controllers for requests.
What is Model-View-Controller (MVC) in ASP.NET Core?
Model-View-Controller (MVC) — A pattern that splits a web app into three parts: the controller handles each request, the model carries the data, and the view turns that data into HTML. Each part has one job, so each is easier to change.
public class ProductsController : Controller
{
public IActionResult Index()
{
List<Product> products = productDao.GetAll(); // the model
return View(products); // the view
}
}
In a sentence
- “In MVC, the controller loads the products and the view turns them into HTML.”
Level: Apprentice · More ASP.NET Core terms at this level
Updated