- Create a new controller
ViewsController - Create the action method
Indexand return a view - Create a view returning HTML in the correct folder for the
Indexaction method and theViewsController - Create the action method
PassingData1and return data to a corresponding view usingViewBag - Use Razor syntax to display the view data
- Create the action method
PassingData2and return data to the view using a model - Use Razor syntax to display model information
- Create a layout page and define to use the layout page by default
- Create the action method
UsingLayoutand return a view that makes use of the layout page - Create an optional section in the layout page and specify to replace this section using the view
- Create a partial view
MyPartialViewand use it directly from the viewUsingLayoutusing Razor code - Create a partial view
MyPartialBookViewand use a model for this view - Create a view where the
MyPArtialBookViewis used and pass the model to the partial view - Create the action method
GetBooksand return a partial view, use a model. Extend the repository to return a list of books. - Use the partial view from a view using jQuery
- Create a view component
BooksViewComponent - Implement dependency injection
- Implement the InvokeAsync method
- Define the user interface for the view-component
- Invoke the view-component from a view