LabWork05_Hard: Фиксы

This commit is contained in:
Safgerd 2023-04-23 15:53:26 +04:00
parent 53817233dc
commit fe90954785
3 changed files with 12 additions and 12 deletions

View File

@ -51,7 +51,7 @@ namespace AutomobilePlantRestApi.Controllers
carCount.Add(new Tuple<string, int>(car.Value.Item1.CarName, car.Value.Item2));
}
shop = new ShopViewModel()
shop = new()
{
Id = shop.Id,
Name = shop.Name,

View File

@ -4,6 +4,7 @@ using AutomobilePlantContracts.ViewModels;
using AutomobilePlantShopApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using System.Xml.Linq;
namespace AutomobilePlantShopApp.Controllers
{
@ -105,7 +106,7 @@ namespace AutomobilePlantShopApp.Controllers
return View();
}
[HttpPost]
public void Update(int shop, string shopName, string address, DateTime dateOpening, int count)
public void Update(int shop, string name, string address, DateTime openingDate, int count)
{
if (!APIClient.isAuth)
{
@ -115,9 +116,9 @@ namespace AutomobilePlantShopApp.Controllers
APIClient.PostRequest($"api/shop/updateshop", new ShopBindingModel
{
Id = shop,
Name = shopName,
Name = name,
Address = address,
OpeningDate = dateOpening,
OpeningDate = openingDate,
MaxCountCars = count
}
);

View File

@ -13,7 +13,7 @@
</div>
<div class="row mb-3">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="name" id="name" /></div>
<div class="col-8"><input type="text" id="name" name="name" /></div>
</div>
<div class="row mb-3">
<div class="col-4">Адрес:</div>
@ -22,7 +22,7 @@
<div class="row mb-3">
<div class="col-4">Дата открытия:</div>
<div class="col-8">
<input type="datetime-local" id="openingDate" name="openingDate" />
<input type="date" id="openingDate" name="openingDate" /></div>
</div>
</div>
<div class="row mb-3">
@ -39,7 +39,7 @@
<th>Количество</th>
</tr>
</thead>
<tbody id="carсount">
<tbody id="carCount">
</tbody>
</table>
</div>
@ -66,11 +66,10 @@
});
}
function fillTable(carcount) {
$("#carcount").empty();
function fillTable(CarCount) {
$("#carCount").empty();
for (var i = 0; i < carcount.length; i++)
$("#carcount").append('<tr><td>' + carcount[i].item1 +
'</td><td>' + carcount[i].item2 + '</td></tr>');
for (var i = 0; i < CarCount.length; i++)
$("#carCount").append('<tr><td>' + carCount[i].item1 + '</td><td>' + carCount[i].item2 + '</td></tr>');
}
</script>