From 31c0173dacb1a149253539c4999be934ff751537 Mon Sep 17 00:00:00 2001 From: Timourka Date: Sun, 7 Apr 2024 04:53:21 +0400 Subject: [PATCH] =?UTF-8?q?LC5=20=D0=BD=D0=B0=D0=B4=D0=BE=20=D0=B1=D1=8B?= =?UTF-8?q?=D0=BB=D0=BE=20=D1=81=D1=80=D0=B0=D0=B7=D1=83=20=D0=B8=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D1=8D=D1=82=D0=BE=D1=82=20=D0=BA=D0=BE=D1=81=D1=82=D1=8B=D0=BB?= =?UTF-8?q?=D1=8C=20=D0=BB=D1=91=D0=B3=20=D0=B1=D1=8B=20=D1=81=D0=BF=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=B0=205=20=D1=87=D0=B0=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=20=D1=80=D0=B0=D0=BD=D1=8C=D1=88=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutomobilePlantContracts/ViewModels/ShopViewModel.cs | 2 ++ .../AutomobilePlantRestApi/Controllers/ShopController.cs | 5 ++++- .../AutomobilePlantShopApp/Views/Home/Update.cshtml | 4 ++-- .../AutomobilePlantShopApp/Views/Home/_Layout.cshtml | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs b/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs index 66472a4..dec4a2d 100644 --- a/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs +++ b/AutomobilePlant/AutomobilePlantContracts/ViewModels/ShopViewModel.cs @@ -25,5 +25,7 @@ namespace AutomobilePlantContracts.ViewModels public DateTime OpeningDate { get; set; } public Dictionary ShopCars { get; set; } = new(); + + public List>? CarAndCount { get; set; } = new(); } } diff --git a/AutomobilePlant/AutomobilePlantRestApi/Controllers/ShopController.cs b/AutomobilePlant/AutomobilePlantRestApi/Controllers/ShopController.cs index 5e87c7a..d4f3000 100644 --- a/AutomobilePlant/AutomobilePlantRestApi/Controllers/ShopController.cs +++ b/AutomobilePlant/AutomobilePlantRestApi/Controllers/ShopController.cs @@ -25,7 +25,10 @@ namespace AutomobilePlantRestApi.Controllers { try { - return _shop.ReadList(null); + List shops = _shop.ReadList(null); + for (int i = 0; i < shops.Count; i++) + shops[i].CarAndCount = shops[i].ShopCars.Values.ToList().Select( x => (x.Item1.CarName, x.Item2).ToTuple() ).ToList(); + return shops; } catch (Exception ex) { diff --git a/AutomobilePlant/AutomobilePlantShopApp/Views/Home/Update.cshtml b/AutomobilePlant/AutomobilePlantShopApp/Views/Home/Update.cshtml index 0c12b14..537ca2d 100644 --- a/AutomobilePlant/AutomobilePlantShopApp/Views/Home/Update.cshtml +++ b/AutomobilePlant/AutomobilePlantShopApp/Views/Home/Update.cshtml @@ -65,7 +65,7 @@ $("#openingDate").val(new Date(selectedShop.openingDate).toISOString().substring(0, 16)); $("#address").val(selectedShop.address); $("#maxCountCars").val(selectedShop.maxCountCars); - fillTable(selectedShop.shopCars); + fillTable(selectedShop.carAndCount); } } @@ -73,6 +73,6 @@ $("#carTable").empty(); for (var car in shopCars) - $("#carTable").append('' + car.Value.Item1.CarName + '' + car.Value.Item2 + ''); + $("#carTable").append('' + shopCars[car].item1 + '' + shopCars[car].item2 + ''); } \ No newline at end of file diff --git a/AutomobilePlant/AutomobilePlantShopApp/Views/Home/_Layout.cshtml b/AutomobilePlant/AutomobilePlantShopApp/Views/Home/_Layout.cshtml index 9b2a5aa..b1dc757 100644 --- a/AutomobilePlant/AutomobilePlantShopApp/Views/Home/_Layout.cshtml +++ b/AutomobilePlant/AutomobilePlantShopApp/Views/Home/_Layout.cshtml @@ -40,7 +40,7 @@
- © 2023 - AutomobilePlantShopApp - Privacy + © 2024 - AutomobilePlantShopApp - Privacy