MVC trong .NET Core là gì?
MVC trong .NET Core là gì?
MVC (Model–View–Controller) trong ASP.NET Core là mẫu kiến trúc tách ứng dụng web thành:
| Thành phần | Vai trò |
|---|---|
| Model | Dữ liệu + logic nghiệp vụ (entity, view model, DTO) |
| View | Giao diện Razor (.cshtml) |
| Controller | Nhận request, gọi service/ model, trả View/ dữ liệu (ActionResult) |
public class ProductsController(IProductService svc) : Controller
{
[HttpGet("products/{id:int}")]
public async Task<IActionResult> Details(int id)
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.