Views

In the MVC pattern, a View is meant to display the application data to the user and handle user interaction. View helps us to implement the separation of concern design principle in MVC applications, by separating the user interface from business logic. It is an HTML page with additional Razor markup apart from the HTML markup, as we have seen earlier in this chapter. The .cshtml files are Views and treated as web pages. For example, if we create a simple MVC application, it creates a View under the Views folder and each View is associated with a controller. In the following example, HomeController is calling three Views—Index, About, and Contact . Inside the Views folder, we have a sub-folder with the controller name (Home) and this ...

Get .NET Core 2.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.