示例#1
0
        public ActionResult AddAdvert(AdvertModel model)
        {
            if (AdminAdverts.GetAdvertPositionById(model.AdPosId) == null)
            {
                ModelState.AddModelError("AdPosId", "广告位置不存在");
            }

            if (ModelState.IsValid)
            {
                AdvertInfo advertInfo = new AdvertInfo()
                {
                    ClickCount   = 0,
                    AdPosId      = model.AdPosId,
                    Title        = model.Title,
                    Image        = model.Image ?? "",
                    Url          = model.Url ?? "",
                    StartTime    = model.StartTime,
                    EndTime      = model.EndTime,
                    ExtField1    = model.ExtField1 ?? "",
                    ExtField2    = model.ExtField2 ?? "",
                    ExtField3    = model.ExtField3 ?? "",
                    ExtField4    = model.ExtField4 ?? "",
                    ExtField5    = model.ExtField5 ?? "",
                    State        = model.State,
                    DisplayOrder = model.DisplayOrder
                };

                AdminAdverts.CreateAdvert(advertInfo);
                AddAdminOperateLog("添加广告", "添加广告,广告为:" + model.Title);
                return(PromptView("广告添加成功"));
            }
            Load();
            return(View(model));
        }
示例#2
0
        public ActionResult EditAdvertPosition(int adPosId = -1)
        {
            AdvertPositionInfo advertPositionInfo = AdminAdverts.GetAdvertPositionById(adPosId);

            if (advertPositionInfo == null)
            {
                return(PromptView("广告位置不存在"));
            }

            AdvertPositionModel model = new AdvertPositionModel();

            model.Title       = advertPositionInfo.Title;
            model.Description = advertPositionInfo.Description;

            ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
            return(View(model));
        }
示例#3
0
        public ActionResult EditAdvertPosition(AdvertPositionModel model, int adPosId = -1)
        {
            AdvertPositionInfo advertPositionInfo = AdminAdverts.GetAdvertPositionById(adPosId);

            if (advertPositionInfo == null)
            {
                return(PromptView("广告位置不存在"));
            }

            if (ModelState.IsValid)
            {
                advertPositionInfo.Title       = model.Title;
                advertPositionInfo.Description = model.Description ?? "";

                AdminAdverts.UpdateAdvertPosition(advertPositionInfo);
                AddAdminOperateLog("修改广告位置", "修改广告位置,广告位置ID为:" + adPosId);
                return(PromptView("广告位置修改成功"));
            }

            ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
            return(View(model));
        }