Razor Views
Razor Views: Passing a Model to a View, Razor Syntax and Tag Helpers, Layouts and _ViewStart.
Updated
- Passing a Model to a View (Journeyman): An action hands its view a model with View(model); the view names the model's type with @model and reads it through Model. ViewData carries small extras, such as the page title.
- Razor Syntax and Tag Helpers (Journeyman): Mix C# into HTML with Razor's @ expressions, code blocks, if and foreach, and let tag helpers such as asp-action and asp-route-id write your links.
- Layouts and _ViewStart (Apprentice): A layout holds the frame every page shares (the head, the menu, the footer) and @RenderBody() marks where each view goes. _ViewStart picks the layout, and _ViewImports holds what every view needs.