/// <summary> /// 添加/编辑 /// </summary> /// <param name="entity"></param> /// <param name="keyValue"></param> /// <returns></returns> public object Sumbit(T_SAPOIL entity, string keyValue) { var op = OperatorProvider.Provider.GetCurrent(); try { if (string.IsNullOrEmpty(op.UserCode)) { return(new { state = false, message = "当前登录人失效,请重新登录!" }); } if (string.IsNullOrEmpty(keyValue)) { //添加 _repository.Insert(entity); } else { //编辑 _repository.Update(entity); } return(new { state = true }); } catch (Exception ex) { return(new { state = false, message = ex.ToString() }); } }
public ActionResult Sumbit(T_SAPOIL entity, string keyValue) { using (var app = new OILTypeApp()) { var data = app.Sumbit(entity, keyValue); return(Content(data.ToJson())); } }