Add a controller
Last updated
Last updated
The MVC project contains folders for the Controllers and Views, follow the steps shown below
In Solution Explorer, right-click Controllers > Add > Controller.
In the Add New Scaffolded Item dialog box, select MVC Controller - Empty > Add.
In the Add New Item - MvcMovie dialog, enter HelloWorldController.cs
and select Add.
Replace the contents of Controllers/HelloWorldController.cs
with the following code: