Ejemplo n.º 1
0
        public ActionResult Add(StoreRankModel model)
        {
            if (AdminStoreRanks.GetStoreRidByTitle(model.RankTitle) > 0)
            {
                ModelState.AddModelError("RankTitle", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                StoreRankInfo storeRankInfo = new StoreRankInfo()
                {
                    Title          = model.RankTitle,
                    Avatar         = model.Avatar ?? "",
                    HonestiesLower = model.HonestiesLower,
                    HonestiesUpper = model.HonestiesUpper,
                    ProductCount   = model.ProductCount
                };

                AdminStoreRanks.CreateStoreRank(storeRankInfo);
                AddMallAdminLog("添加店铺等级", "添加店铺等级,店铺等级为:" + model.RankTitle);
                return(PromptView("店铺等级添加成功"));
            }
            Load();
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(StoreRankModel model, int storeRid = -1)
        {
            StoreRankInfo storeRankInfo = AdminStoreRanks.GetStoreRankById(storeRid);

            if (storeRankInfo == null)
            {
                return(PromptView("店铺等级不存在"));
            }

            int storeRid2 = AdminStoreRanks.GetStoreRidByTitle(model.RankTitle);

            if (storeRid2 > 0 && storeRid2 != storeRid)
            {
                ModelState.AddModelError("RankTitle", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                storeRankInfo.Title          = model.RankTitle;
                storeRankInfo.Avatar         = model.Avatar ?? "";
                storeRankInfo.HonestiesLower = model.HonestiesLower;
                storeRankInfo.HonestiesUpper = model.HonestiesUpper;
                storeRankInfo.ProductCount   = model.ProductCount;

                AdminStoreRanks.UpdateStoreRank(storeRankInfo);
                AddMallAdminLog("修改店铺等级", "修改店铺等级,店铺等级ID为:" + storeRid);
                return(PromptView("店铺等级修改成功"));
            }

            Load();
            return(View(model));
        }