public ActionResult Save(SystemParam entity) { var hasResult = service.Exists(entity); if (hasResult.Failure) { return Json(hasResult); } var result = entity.Id == 0 ? service.Insert(entity) : service.Update(entity); return Json(result); }
/// <summary> /// 检测是否存在指定参数 /// </summary> /// <param name="entity">参数实体</param> /// <returns>存在返回true</returns> public BoolMessage Exists(SystemParam entity) { var has = repos.Exists(p => p.Code == entity.Code && p.Id != entity.Id); return has ? new BoolMessage(false, "输入流程参数编码已经存在") : BoolMessage.True; }
/// <summary> /// 更新参数 /// </summary> /// <param name="entity">参数实体</param> public BoolMessage Update(SystemParam entity) { try { repos.Update(entity); return BoolMessage.True; } catch (Exception e) { return new BoolMessage(false, e.Message); } }
private ActionResult EditCore(SystemParam entity) { return View("Edit", entity); }