Exemplo n.º 1
0
        public async Task <IActionResult> UpdateShop(int shopId, Shop shop)
        {
            Shop exiShop = await _shopLogic.FindAsync(shopId);

            if (exiShop == null)
            {
                return(NoContent());
            }
            _shopLogic.Update(shop);
            return(Ok(shop));
        }
Exemplo n.º 2
0
 public ActionResult Edit(ShopCreateVM shop)
 {
     try
     {
         if (ModelState.IsValid)
         {
             shop.Rating = _ratingLogic.GetRatingShopById(shop.IDShop);
             _shopLogic.Update(Mapper.Map <ShopCreateVM, Shop>(shop));
             return(RedirectToAction("IndexForModerator"));
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(String.Empty, ex);
     }
     return(View(shop));
 }
Exemplo n.º 3
0
        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);
        }