December 2019
Intermediate to advanced
528 pages
11h 19m
English
The last thing we need to do before we can run our application is to modify the HomeController class to work with the IWorkItemService. Let's set this up by going through the following steps:
private readonly IWorkItemService _workItemService;
public HomeController(IWorkItemService workItemService)
{
_workItemService = workItemService;
}
public IActionResult Index()
{
var workItems = _workItemService.GetAllWorkItems();
return View(workItems);
}
With this code, we are getting all the work items in the MongoDB database and passing them to the view for the model to work with.