public ActionResult EditAdvert(AdvertModel model, int adId = -1) { AdvertInfo advertInfo = Adverts.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.State = model.State; advertInfo.DisplayOrder = model.DisplayOrder; Adverts.UpdateAdvert(oldAdPosId, advertInfo); AddAdminOperateLog("修改广告", "修改广告,广告ID为:" + adId); return(PromptView("广告修改成功")); } Load(); return(View(model)); }
public ActionResult EditAdvert(int adId = -1) { AdvertInfo advertInfo = Adverts.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.State = advertInfo.State; model.DisplayOrder = advertInfo.DisplayOrder; Load(); return(View(model)); }