public IActionResult Create(ShopCUVM model) { if (!ModelState.IsValid) { return(View(GetCreateShopModel(model.Shop))); } _shopOperation.CreateShop(model.Shop); return(RedirectToAction(nameof(Index))); }
private ShopCUVM GetCreateShopModel(ShopCUDTO shop) { IEnumerable <ProductListDTO> Products = _productOperation.GetAll(); ShopCUVM model = new ShopCUVM() { Components = _shopOperation.GetShopFormComponents(), Shop = shop, Products = Products }; return(model); }
public IActionResult Edit(ShopCUVM model) { if (!ModelState.IsValid) { return(View(GetUpdateShopModel(model.Shop))); } _shopOperation.DeleteProducts(model.Shop.Id); _shopOperation.UpdateShop(model.Shop); var viewModel = GetUpdateShopModel(model.Shop); ViewBag.Message = "მაღაზია წარმატებით განახლდა!"; return(View(viewModel)); }