Adding a view for the home controller

You need to create a view for the home controller's Index action in order to test the template. Complete the following steps to accomplish this:

  1. Open the HomeController.cs file and, if the HomeController class does not already contain an Index action method, add it as shown here:
            public IActionResult Index() 
            { 
                return View(); 
            } 
    
  2. Next, right-click on the Views\Home folder and Add | New Item... from the context menu.
  3. Select MVC View Page from the list of project items, make sure the name is Index.cshtml, and click on Add:
    Adding a view for the home controller
  4. Open the newly created Index.cshtml file and change its markup to ...

Get Bootstrap for ASP.NET MVC - Second Edition 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.