Example #1
0
        public ActionResult EditAdvert(AdvertModel model, int adId = -1)
        {
            AdvertInfo advertInfo = AdminAdverts.AdminGetAdvertById(adId);
            if (advertInfo == null)
                return PromptView("广告不存在");

            int oldAdPosId = advertInfo.AdPosId;
            if (ModelState.IsValid)
            {
                advertInfo.AdPosId = model.AdPosId;
                advertInfo.Type = model.Type;
                advertInfo.Title = model.Title;
                advertInfo.Body = model.Body;
                advertInfo.Url = model.Url ?? "";
                advertInfo.StartTime = model.StartTime;
                advertInfo.EndTime = model.EndTime;
                advertInfo.ExtField1 = model.ExtField1 ?? "";
                advertInfo.ExtField2 = model.ExtField2 ?? "";
                advertInfo.ExtField3 = model.ExtField3 ?? "";
                advertInfo.ExtField4 = model.ExtField4 ?? "";
                advertInfo.ExtField5 = model.ExtField5 ?? "";
                advertInfo.State = model.State;
                advertInfo.DisplayOrder = model.DisplayOrder;

                AdminAdverts.UpdateAdvert(oldAdPosId, advertInfo);
                AddMallAdminLog("修改广告", "修改广告,广告ID为:" + adId);
                return PromptView("广告修改成功");
            }

            Load();
            return View(model);
        }
Example #2
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,
                    Type = model.Type,
                    Title = model.Title,
                    Body = model.Body,
                    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);
                AddMallAdminLog("添加广告", "添加广告,广告为:" + model.Title);
                return PromptView("广告添加成功");
            }
            Load();
            return View(model);
        }
Example #3
0
        public ActionResult EditAdvert(int adId = -1)
        {
            AdvertInfo advertInfo = AdminAdverts.AdminGetAdvertById(adId);
            if (advertInfo == null)
                return PromptView("广告不存在");

            AdvertModel model = new AdvertModel();
            model.AdPosId = advertInfo.AdPosId;
            model.Type = advertInfo.Type;
            model.Title = advertInfo.Title;
            model.Body = advertInfo.Body;
            model.Url = advertInfo.Url;
            model.StartTime = advertInfo.StartTime;
            model.EndTime = advertInfo.EndTime;
            model.ExtField1 = advertInfo.ExtField1;
            model.ExtField2 = advertInfo.ExtField2;
            model.ExtField3 = advertInfo.ExtField3;
            model.ExtField4 = advertInfo.ExtField4;
            model.ExtField5 = advertInfo.ExtField5;
            model.State = advertInfo.State;
            model.DisplayOrder = advertInfo.DisplayOrder;

            Load();
            return View(model);
        }
Example #4
0
 public ActionResult AddAdvert()
 {
     AdvertModel model = new AdvertModel();
     Load();
     return View(model);
 }