Creating the MVC controller

As the first step, we will need to add an MVC controller. We will inject DbContext into the controller via the dependency injection so that we can have access to TextScoreDB when the controller loads. Then we will add an Index action to the controller, and pass the records stored in the DocumentTextScore table to the Index MVC view as a model.

Lets create the MVC controller by executing the following steps:

  1. Right-click on Controllers and click on Add -> New Item -> MVC Controller.
  2. Modify the controller code to look like the following:
        using System.Linq;        using Microsoft.AspNetCore.Mvc;        using TextScoreDashboard.Models;        namespace TextScoreDashboard.Controllers       {            public class DocumentsController : Controller           {

Get Serverless computing in Azure with .NET 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.