ASP.NET Core MVC Interview Question #2
What does MVC stand for, and what are the responsibilities of Model, View, and Controller?
MVC Fundamentals, Controllers, Views & Routing Junior Beginner
Quick Interview Answer
MVC stands for Model-View-Controller. The Model represents application data, domain rules, or view-specific data. The View is responsible for presenting HTML to the user. The Controller receives HTTP requests, coordinates application services or models, and selects the response, often by returning a view.
Detailed Explanation
MVC stands for Model-View-Controller. The Model represents application data, domain rules, or view-specific data. The View is responsible for presenting HTML to the user. The Controller receives HTTP requests, coordinates application services or models, and selects the response, often by returning a view.
A well-designed MVC application keeps business logic out of views and avoids placing excessive business or data-access logic directly in controllers.
Code Example
// Model / ViewModel
public class ProductViewModel
{
public string Name { get; set; } = string.Empty;
}
// Controller
public IActionResult Details()
{
return View(new ProductViewModel { Name = "Laptop" });
}