diff --git a/Chapter_34/AutoLot.Web/Pages/Cars/Index.cshtml.cs b/Chapter_34/AutoLot.Web/Pages/Cars/Index.cshtml.cs index d005f5e..2aa03b0 100644 --- a/Chapter_34/AutoLot.Web/Pages/Cars/Index.cshtml.cs +++ b/Chapter_34/AutoLot.Web/Pages/Cars/Index.cshtml.cs @@ -1,19 +1,12 @@ namespace AutoLot.Web.Pages.Cars; -public class IndexModel : PageModel +public class IndexModel : BasePageModel { - private readonly IAppLogging _appLogging; - private readonly ICarDataService _carService; - - [ViewData] - public string Title => "Inventory"; - - public IndexModel(IAppLogging appLogging, ICarDataService carService) - { - _appLogging = appLogging; - _carService = carService; - } - + public IndexModel( + IAppLogging appLogging, + ICarDataService dataService) : base(appLogging, dataService, "Inventory") + {} + public string MakeName { get; set; } public int? MakeId { get; set; } public IEnumerable CarRecords { get; set; } @@ -21,6 +14,6 @@ public async Task OnGetAsync(int? makeId, string makeName) { MakeId = makeId; MakeName = makeName; - CarRecords = await _carService.GetAllByMakeIdAsync(makeId); + CarRecords = await ((ICarDataService)DataService).GetAllByMakeIdAsync(makeId); } -} \ No newline at end of file +}