public ActionResult AddOrEdit(int?id) { SysSlide entity = null; if (!string.IsNullOrEmpty(id.ToString())) { entity = _sysslideService.Get(Convert.ToInt32(id)); } entity = entity ?? new SysSlide { ImgUrl = string.Empty, ImgTitle = string.Empty, LinkUrl = string.Empty, }; ViewBag.entity = entity; return(View(entity)); }
public ActionResult Save(SysSlide entity) { if (entity.Id == 0) { base._sysslideService.Save(entity); } else { var model = base._sysslideService.Get(entity.Id); model.ImgTitle = entity.ImgTitle; model.ImgUrl = entity.ImgUrl; model.LinkUrl = entity.LinkUrl; model.OrderNo = entity.OrderNo; base._sysslideService.Update(model); } return(Json(new CommonResult { Success = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet)); }