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.Title = model.Title; advertInfo.Image = model.Image ?? ""; 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); AddAdminOperateLog("修改广告", "修改广告,广告ID为:" + adId); return(PromptView("广告修改成功")); } Load(); return(View(model)); }
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.Title = advertInfo.Title; model.Image = advertInfo.Image; 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)); }