Hãy giải thích Model, Controller và View trong ASP.NET MVC?
Hãy giải thích Model, Controller và View trong ASP.NET MVC?
| Thành phần | Vai trò | Ví dụ |
|---|---|---|
| Model | Dữ liệu + logic nghiệp vụ/ validation, không biết giao diện | Product, Order, service/ repository |
| View | Hiển thị dữ liệu cho người dùng (Razor .cshtml) |
Views/Products/Index.cshtml |
| Controller | Nhận request, gọi model/ service, chọn View | ProductsController |
Request → Routing → Controller (action) → Model → ViewModel → View (Razor) → HTML Response
Đă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.