O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding ASP.NET MVC HomeController

This controller has a single action called Index that returns the Index view as a response. The following is the code snippet of the Index action:

public IActionResult Index() 
{ 
    return View(); 
} 

When a request is routed to the Index action, it will return the Index view. The source code of Index.cshtml is as shown in the following code snippet:

 @{ 
    Layout = null; 
} 
<!DOCTYPE html> 
<html> 
<head> 
    <meta name="viewport" content="width=device-width" /> 
    <title>Index</title> 
</head> 
<body> 
    <h1>index view</h1> 
</body> 
</html> 

Follow the given steps to add the ASP.NET MVC HomeController and its corresponding view to our My Todo application created in the earlier chapters:

  1. Right-click on the Controllers folder ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required