Creating a UI using ASP.NET Core MVC
Up until now, we have defined a service to communicate with backend APIs and further defined controllers that will pass the data to views using models. Now, let's build various views that will render the data and present it to users.
To begin with, let's see the various components that are involved in rendering the views:
- The
Viewsfolder: All views are part of this folder, with each controller-specific view segregated by a subfolder, and finally, each action method is represented by a.cshtmlfile.
To add a view, we can right-click on the action method and click Add View, which will automatically create a folder (if it isn't already present) with the name of the controller and add the view. Additionally, while doing this, we can specify the model that the view would be bound to.
- The
Layoutpage: This is a common requirement in a web application where we have a common section across the application, such...