Introduction to ASP.NET Core part 8: MVC continued with controller actions and our first view
February 1, 2017 Leave a comment
Introduction
In the previous post we started looking into MVC in .NET Core. We added a new library through NuGet and wired up the MVC middleware in Startup.cs. Routing is about mapping parts of the requested URL to a controller and an action. The controller is a normal C# class which most often derives from the Controller base class. The action is a C# function that returns some type of response to the HTTP request. The action can have 0, 1 or more parameters that must match the query parameters of the URL otherwise the routing engine won’t find it. We also wrote our first controller called the HomeController and the first action called Index which corresponds to the /home/index URL. We also discussed the basics of routing and added a very basic convention based route to Startup.cs.
