ASP.NET core 5.0 MVC Controller Edit

Murugan Andezuthu Dharmaratnam | 18 January 2021 | 236

Introduction

Controllers classes can process requests from client machine. They retrieve model data and call view .cshtml file that return a response. The view only displays information, the controller handles and responds to user input and request.
Example, the controller handles route data and query-string values, and passes these values to the model. The model can used these values to query the database.

How to Add a Controller in Visual Studio 2019

In the Solution Explorer, right-click Controllers Then Click on Add Then Select Controller

In the Add Scaffold dialog box, select MVC Controller - Empty Then Click on Add

Every controller in MVC must be derived from this abstract Controller class. This base Controller class contains helper methods that can be used for various purposes.