LC5 надо было сразу использовать этот костыль лёг бы спать на 5 часов раньше
This commit is contained in:
parent
6ee1a91f89
commit
31c0173dac
@ -25,5 +25,7 @@ namespace AutomobilePlantContracts.ViewModels
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
public Dictionary<int, (ICarModel, int)> ShopCars { get; set; } = new();
|
||||
|
||||
public List<Tuple<string, int>>? CarAndCount { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,10 @@ namespace AutomobilePlantRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _shop.ReadList(null);
|
||||
List<ShopViewModel> 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)
|
||||
{
|
||||
|
@ -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('<tr><td>' + car.Value.Item1.CarName + '</td><td>' + car.Value.Item2 + '</td></tr>');
|
||||
$("#carTable").append('<tr><td>' + shopCars[car].item1 + '</td><td>' + shopCars[car].item2 + '</td></tr>');
|
||||
}
|
||||
</script>
|
@ -40,7 +40,7 @@
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2023 - AutomobilePlantShopApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© 2024 - AutomobilePlantShopApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user