using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using RepositoryLibrary; using WebMVC.Models; namespace WebMVC.Controllers { public class HomeController : Controller { private readonly ILogger _logger; private readonly IRepository _repository; public HomeController(ILogger logger, IRepository repository) { _logger = logger; _repository = repository; } public IActionResult Index() { return View(); } public async Task Privacy() { // To get this working, I have make a call here in the Privacy page. // Making the call in the Home/Index page was always returning a 404 Not Found. // The second project was not starting quickly enough. var lookup = await _repository.Lookup(); return View(); } [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } }