1.
Model
- Role:
- Handles application data and business logic.
- Transfers data between the Controller and View.
- Key Points:
- Interacts with the database to manage application data.
- Encapsulates data in public properties.
- Stored in the Model folder in MVC.
2. View
- Role:
- Provides the user interface for displaying data and interacting with the application.
- Types:
1. ASPX View Engine: Uses .ASPX files.
2. Razor View Engine: Uses .CSHTML files, simpler and HTML-friendly.
- Key Points:
- Stored in the Views folder, organized by Controller name.
- Example: Views for HomeController are in Views > Home.
- Allows mixing HTML with server-side code (C#, [Link]).
3. Controller
- Role:
- Connects user input, Model, and View.
- Handles browser requests and sends responses.
- Key Points:
- Stored in the Controller folder.
- Controller class:
- Ends with "Controller" (e.g., HomeController).
- Contains public methods called Action Methods.
- Transfers data to Views using ViewData, ViewBag, and TempData.