コード例 #1
0
        public ActionResult AddSupply()
        {
            SupplyAddModel model = new SupplyAddModel();

            model.Shops         = providerContext.Shops().Select(c => (ShopModel)c).ToList();
            model.Supply.ShopId = model.Shops.FirstOrDefault().Id;

            return(PartialView("~/Views/ProviderPage/_AddSupply.cshtml", model));
        }
コード例 #2
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));
        }
コード例 #3
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));
        }
コード例 #4
0
        public ActionResult AddSupply(SupplyAddModel model)
        {
            if (ModelState.IsValid)
            {
                SupplyBs bs     = new SupplyBs();
                var      result = bs.Add((SupplyDTO)model.Supply);

                if (result.Code == BusinessLayer.OperationStatusEnum.Success)
                {
                    TempData["OperationStatus"] = true;
                    TempData["OpearionMessage"] = "Поставка успешно добавлена";

                    return(RedirectToAction("Index", "ProviderPage"));
                }
                else
                {
                    TempData["OperationStatus"] = false;
                    TempData["OpearionMessage"] = result.Message;
                }
            }

            return(PartialView("~/Views/ProviderPage/_AddSupply.cshtml", model));
        }
コード例 #5
0
        public ActionResult EditSupply(SupplyAddModel model)
        {
            if (ModelState.IsValid)
            {
                SupplyBs bs     = new SupplyBs();
                var      result = bs.Update((SupplyDTO)model.Supply);

                if (result.Code == BusinessLayer.OperationStatusEnum.Success)
                {
                    TempData["OperationStatus"] = true;
                    TempData["OpearionMessage"] = "Поставка успешно изменена";

                    return(RedirectToAction("Supplies", "Admin"));
                }
                else
                {
                    TempData["OperationStatus"] = false;
                    TempData["OpearionMessage"] = result.Message;
                }
            }

            return(View(model));
        }