Before we jump in and run the application, let's make sure our new page is easily accessible. The simplest way to do that is to just set it as the default home page:
- Have a look at the Configure method in Startup.cs. You'll notice that the default route is specified as the Home controller.
- Simply change the controller to your Research controller as follows:
app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Researches}/{action=Index}/{id?}"); });
- Lastly, make sure that your Main method looks as follows:
public static void Main(string[] args){ var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService<ResearchContext>(); ...