Exemplo n.º 1
0
        public ActionResult Edit(StoreIndustryModel model, int storeIid = -1)
        {
            StoreIndustryInfo storeIndustryInfo = AdminStoreIndustries.GetStoreIndustryById(storeIid);

            if (storeIndustryInfo == null)
            {
                return(PromptView("店铺行业不存在"));
            }

            int storeIid2 = AdminStoreIndustries.GetStoreIidByTitle(model.IndustryTitle);

            if (storeIid2 > 0 && storeIid2 != storeIid)
            {
                ModelState.AddModelError("IndustryTitle", "行业标题已经存在");
            }

            if (ModelState.IsValid)
            {
                storeIndustryInfo.Title        = model.IndustryTitle;
                storeIndustryInfo.DisplayOrder = model.DisplayOrder;

                AdminStoreIndustries.UpdateStoreIndustry(storeIndustryInfo);
                AddMallAdminLog("修改店铺行业", "修改店铺行业,店铺行业ID为:" + storeIid);
                return(PromptView("店铺行业修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Add(StoreIndustryModel model)
        {
            if (AdminStoreIndustries.GetStoreIidByTitle(model.IndustryTitle) > 0)
            {
                ModelState.AddModelError("IndustryTitle", "行业标题已经存在");
            }

            if (ModelState.IsValid)
            {
                StoreIndustryInfo storeIndustryInfo = new StoreIndustryInfo()
                {
                    Title        = model.IndustryTitle,
                    DisplayOrder = model.DisplayOrder
                };

                AdminStoreIndustries.CreateStoreIndustry(storeIndustryInfo);
                AddMallAdminLog("添加店铺行业", "添加店铺行业,店铺行业为:" + model.IndustryTitle);
                return(PromptView("店铺行业添加成功"));
            }
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }