public ActionResult Save(SysIcon entity) { if (entity.Id == 0) { if (_sysiconService.IsExist(entity.Id)) { return(Json(new CommonResult { Success = false, Message = "标题已经存在,请重新输入!" }, "text/html", JsonRequestBehavior.AllowGet)); } base._sysiconService.Save(entity); } else { var model = base._sysiconService.Get(entity.Id); model.Title = entity.Title; model.Img = entity.Img; model.OrderNo = entity.OrderNo; model.Url = entity.Url; model.IsEnabled = entity.IsEnabled; base._sysiconService.Update(model); } return(Json(new CommonResult { Success = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet)); }
public ActionResult AddOrEdit(int?id) { var list = base._sysiconService.LoadAllEnable(); SysIcon entity = null; if (!string.IsNullOrEmpty(id.ToString())) { entity = base._sysiconService.Get(Convert.ToInt32(id)); } entity = entity ?? new SysIcon { Title = string.Empty, }; return(View(entity)); }