lab-5-hard delete problem solve

This commit is contained in:
Zakharov_Rostislav 2024-04-21 20:24:21 +04:00
parent 758fa36320
commit 7ab5b36b0b
2 changed files with 5 additions and 10 deletions

View File

@ -76,16 +76,11 @@ namespace BlacksmithWorkshopRestApi.Controllers
}
[HttpPost]
public bool DeleteShop(ShopSearchModel model)
{
var elem = _logic.ReadElement(model);
if (elem == null)
return false;
try
public bool DeleteShop(ShopBindingModel model)
{
try
{
return _logic.Delete(new ShopBindingModel { Id = elem.Id, Address = elem.Address,
MaxCapacity = elem.MaxCapacity, OpeningDate = elem.OpeningDate,
ShopName = elem.ShopName, ShopManufactures = elem.ShopManufactures});
return _logic.Delete(model);
}
catch (Exception ex)
{

View File

@ -89,7 +89,7 @@ namespace BlacksmithWorkshopShopApp.Controllers
{
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
}
ApiClient.PostRequest("api/shop/deleteshop", new ShopSearchModel
ApiClient.PostRequest("api/shop/deleteshop", new ShopBindingModel
{
Id = shop
});