public ActionResult Edit(int id = -1) { BannerInfo bannerInfo = AdminBanners.AdminGetBannerById(id); if (bannerInfo == null) return PromptView("Banner不存在"); BannerModel model = new BannerModel(); model.BannerType = bannerInfo.Type; model.StartTime = bannerInfo.StartTime; model.EndTime = bannerInfo.EndTime; model.IsShow = bannerInfo.IsShow; model.BannerTitle = bannerInfo.Title; model.Img = bannerInfo.Img; model.Url = bannerInfo.Url; model.DisplayOrder = bannerInfo.DisplayOrder; Load(); return View(model); }
public ActionResult Add(BannerModel model) { if (ModelState.IsValid) { BannerInfo bannerInfo = new BannerInfo() { Type = model.BannerType, StartTime = model.StartTime, EndTime = model.EndTime, IsShow = model.IsShow, Title = model.BannerTitle == null ? "" : model.BannerTitle, Img = model.Img, Url = model.Url, DisplayOrder = model.DisplayOrder }; AdminBanners.CreateBanner(bannerInfo); AddMallAdminLog("添加banner", "添加banner,banner为:" + model.BannerTitle); return PromptView("banner添加成功"); } Load(); return View(model); }
public ActionResult Add() { BannerModel model = new BannerModel(); Load(); return View(model); }
public ActionResult Edit(BannerModel model, int id = -1) { BannerInfo bannerInfo = AdminBanners.AdminGetBannerById(id); if (bannerInfo == null) return PromptView("Banner不存在"); if (ModelState.IsValid) { //bannerInfo.Type = model.BannerType; bannerInfo.StartTime = model.StartTime; bannerInfo.EndTime = model.EndTime; bannerInfo.IsShow = model.IsShow; bannerInfo.Title = model.BannerTitle == null ? "" : model.BannerTitle; bannerInfo.Img = model.Img; bannerInfo.Url = model.Url; bannerInfo.DisplayOrder = model.DisplayOrder; AdminBanners.UpdateBanner(bannerInfo); AddMallAdminLog("修改banner", "修改banner,bannerID为:" + id); return PromptView("banner修改成功"); } Load(); return View(model); }