O'Reilly logo

C# 7 and .NET Core Cookbook by Dirk Strauss

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

How to do it...

  1. Add another folder to your application called Controllers:
  2. Inside the Controllers folder, add a new class called StudentController. Inside the StudentController, add a method called Find(). When you are done, your class will look as follows:
        public class StudentController        {          public string Find()          {            return "Found students";          }        }
  1. Back in the Startup class, add a private void method called FindController() that takes a parameter of type IRouteBuilder. Make sure that you also add the using Microsoft.AspNetCore.Routing; namespace to your class. Your method should look as follows:
 private void FindController(IRouteBuilder route) ...

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