Exemplo n.º 1
0
        public ActionResult EditShop(int id)
        {
            ShopBs    bs    = new ShopBs();
            ShopModel model = (ShopModel)bs.GetById(id);

            return(View(model));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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"));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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));
        }