Esempio n. 1
0
        public ActionResult Edit(int topicId = -1)
        {
            TopicInfo topicInfo = AdminTopic.AdminGetTopicById(topicId);
            if (topicInfo == null)
                return PromptView("活动专题不存在");

            TopicModel model = new TopicModel();
            model.StartTime = topicInfo.StartTime;
            model.EndTime = topicInfo.EndTime;
            model.Title = topicInfo.Title;
            model.HeadHtml = topicInfo.HeadHtml;
            model.BodyHtml = topicInfo.BodyHtml;
            model.IsShow = topicInfo.IsShow;

            ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
            return View(model);
        }
Esempio n. 2
0
        public ActionResult Add(TopicModel model)
        {
            if (ModelState.IsValid)
            {
                string sn = AdminTopic.GenerateTopicSN();
                TopicInfo topicInfo = new TopicInfo()
                {
                    StartTime = model.StartTime,
                    EndTime = model.EndTime,
                    SN = sn,
                    Title = model.Title,
                    HeadHtml = model.HeadHtml ?? "",
                    BodyHtml = model.BodyHtml ?? "",
                    IsShow = model.IsShow
                };

                AdminTopic.CreateTopic(topicInfo);
                AddAdminOperateLog("添加活动专题", "添加活动专题,活动专题为:" + model.Title);
                return PromptView("活动专题添加成功");
            }

            ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
            return View(model);
        }
Esempio n. 3
0
        public ActionResult Edit(TopicModel model, int topicId = -1)
        {
            TopicInfo topicInfo = AdminTopic.AdminGetTopicById(topicId);
            if (topicInfo == null)
                return PromptView("活动专题不存在");

            if (ModelState.IsValid)
            {
                topicInfo.StartTime = model.StartTime;
                topicInfo.EndTime = model.EndTime;
                topicInfo.Title = model.Title;
                topicInfo.HeadHtml = model.HeadHtml ?? "";
                topicInfo.BodyHtml = model.BodyHtml ?? "";
                topicInfo.IsShow = model.IsShow;

                AdminTopic.UpdateTopic(topicInfo);
                AddAdminOperateLog("修改活动专题", "修改活动专题,活动专题ID为:" + topicId);
                return PromptView("活动专题修改成功");
            }

            ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
            return View(model);
        }
Esempio n. 4
0
 public ActionResult Add()
 {
     TopicModel model = new TopicModel();
     ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
     return View(model);
 }