public ActionResult EditShop(int id) { ShopBs bs = new ShopBs(); ShopModel model = (ShopModel)bs.GetById(id); return(View(model)); }
public ActionResult ShopsList(string symbols = "") { ShopBs shop = new ShopBs(); List <ShopModel> model = shop.GetList().Where(c => c.Name.Contains(symbols)).Select(c => (ShopModel)c).ToList(); return(PartialView("~/Views/Admin/_ShopsList.cshtml", model)); }
public ActionResult EditSupply(int id) { ShopBs bs = new ShopBs(); SupplyBs supplyBs = new SupplyBs(); SupplyAddModel model = (SupplyAddModel)supplyBs.GetById(id); model.Shops = bs.GetList().Select(c => (ShopModel)c).ToList(); return(View(model)); }
public ActionResult AddSupply() { ShopBs bs = new ShopBs(); SupplyAddModel model = new SupplyAddModel(); model.Shops = bs.GetList().Select(c => (ShopModel)c).ToList(); model.Supply.ShopId = model.Shops.FirstOrDefault().Id; return(View(model)); }
public ActionResult DeleteShop(int id) { if (ModelState.IsValid) { ShopBs bs = new ShopBs(); var result = bs.Delete(id); if (result.Code == BusinessLayer.OperationStatusEnum.Success) { TempData["OperationStatus"] = true; TempData["OpearionMessage"] = "Данные успешно обновлены"; } else { TempData["OperationStatus"] = false; TempData["OpearionMessage"] = result.Message; } } return(RedirectToAction("Shops", "ProviderPage")); }
public ActionResult AddShop(ShopModel model) { if (ModelState.IsValid) { ShopBs bs = new ShopBs(); var result = bs.Add((ShopDTO)model); if (result.Code == BusinessLayer.OperationStatusEnum.Success) { TempData["OperationStatus"] = true; TempData["OpearionMessage"] = "Магазин успешно добавлен"; return(RedirectToAction("Shops", "ProviderPage")); } else { TempData["OperationStatus"] = false; TempData["OpearionMessage"] = result.Message; } } return(PartialView("~/Views/ProviderPage/_AddShop.cshtml", model)); }
public ActionResult EditShop(ShopModel model) { if (ModelState.IsValid) { ShopBs bs = new ShopBs(); var result = bs.Update((ShopDTO)model); if (result.Code == BusinessLayer.OperationStatusEnum.Success) { TempData["OperationStatus"] = true; TempData["OpearionMessage"] = "Данные успешно обновлены"; return(RedirectToAction("Shops", "Admin")); } else { TempData["OperationStatus"] = false; TempData["OpearionMessage"] = result.Message; } } return(View(model)); }