From 758fa363206eca1b61f4840fd824bb5e9de54101 Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Sun, 21 Apr 2024 20:18:51 +0400 Subject: [PATCH] lab-5-hard delete problem --- .../Controllers/ShopController.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopRestApi/Controllers/ShopController.cs b/BlacksmithWorkshop/BlacksmithWorkshopRestApi/Controllers/ShopController.cs index ed9d91d..6d1f07d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopRestApi/Controllers/ShopController.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopRestApi/Controllers/ShopController.cs @@ -76,11 +76,16 @@ namespace BlacksmithWorkshopRestApi.Controllers } [HttpPost] - public bool DeleteShop(ShopBindingModel model) - { - try + public bool DeleteShop(ShopSearchModel model) + { + var elem = _logic.ReadElement(model); + if (elem == null) + return false; + try { - return _logic.Delete(model); + return _logic.Delete(new ShopBindingModel { Id = elem.Id, Address = elem.Address, + MaxCapacity = elem.MaxCapacity, OpeningDate = elem.OpeningDate, + ShopName = elem.ShopName, ShopManufactures = elem.ShopManufactures}); } catch (Exception ex) {