From 677e2ce472a4e88e6d70244e369b1ed928b4c116 Mon Sep 17 00:00:00 2001 From: AlexFromKiyv <81460397+AlexFromKiyv@users.noreply.github.com> Date: Sat, 29 Nov 2025 12:36:06 +0200 Subject: [PATCH] Update Index.cshtml.cs Here you can take advantage of the basic class BasePageModel. Here you can take advantage of the basic class BasePageModel. What has already been done there is repeated. --- .../Areas/Admin/Pages/Makes/Index.cshtml.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Chapter_34/AutoLot.Web/Areas/Admin/Pages/Makes/Index.cshtml.cs b/Chapter_34/AutoLot.Web/Areas/Admin/Pages/Makes/Index.cshtml.cs index 05973ff..f7afafa 100644 --- a/Chapter_34/AutoLot.Web/Areas/Admin/Pages/Makes/Index.cshtml.cs +++ b/Chapter_34/AutoLot.Web/Areas/Admin/Pages/Makes/Index.cshtml.cs @@ -1,22 +1,17 @@ namespace AutoLot.Web.Areas.Admin.Pages.Makes; -public class IndexModel : PageModel +public class IndexModel : BasePageModel { - private readonly IAppLogging _appLogging; - private readonly IMakeDataService _makeService; - - [ViewData] - public string Title => "Makes"; - - public IndexModel(IAppLogging appLogging, IMakeDataService carService) + public IndexModel( + IAppLogging appLogging, + IMakeDataService makeService) + : base(appLogging, makeService, "Makes") { - _appLogging = appLogging; - _makeService = carService; } public IEnumerable MakeRecords { get; set; } public async Task OnGetAsync() { - MakeRecords = await _makeService.GetAllAsync(); + MakeRecords = await DataService.GetAllAsync(); } -} \ No newline at end of file +}