public RedirectToRouteResult DeletePost(int idShop) { try { if (ModelState.IsValid) { _shopLogic.DeleteById(idShop); return(RedirectToAction("IndexForModerator")); } } catch (Exception ex) { ModelState.AddModelError(String.Empty, ex); } return(RedirectToAction("Delete")); }
public void Update() { var oldShop = new Common.Shop() { NameShop = "Lime", Address = "Зарубина", DescriptionShop = "Кафе", Website = "lime.ru", Rating = 0, PhoneShop = "+7909323232", City = "Saratov", OpeningHours = "9:00-21:00" }; int id = logic.AddShop(oldShop); Common.Shop shop = logic.GetShopById(id); shop.NameShop = "For update"; logic.Update(shop); Assert.AreEqual(Common.Shop.ToString(logic.GetShopById(id)), Common.Shop.ToString(shop), "Adding data about shop incorrect"); logic.DeleteById(id); }