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:
- Open the
HomeController.cs
file and, if theHomeController
class does not already contain an Index action method, add it as shown here:public IActionResult Index() { return View(); }
- Next, right-click on the
Views
\Home
folder and Add | New Item... from the context menu. - Select MVC View Page from the list of project items, make sure the name is
Index.cshtml
, and click on Add: - 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.