public MessageModel UpdateSingleEntity(CodeObjectModel model) { Func <IEntityContext, string> operation = delegate(IEntityContext context) { var data = context.CodeObject.FirstOrDefault(m => m.ObjectID == model.ObjectID); if (data == null) { return("当前数据不存在或被更新,请刷新后再次操作!"); } data.ObjectCode = model.ObjectCode; data.ObjectName = model.ObjectName; data.Prefix = model.Prefix; data.MaxLength = model.MaxLength; data.SeqLength = model.SeqLength; data.IsFixedLength = model.IsFixedLength; data.IsAuto = model.IsAuto; data.SortID = model.SortID; data.Remark = model.Remark; data.IsLocked = model.IsLocked; data.IsShow = model.IsShow; data.ModifyID = model.ModifyID; data.ModifyName = model.ModifyName; data.ModifyTime = DateTime.Now; context.SaveChanges(); return(string.Empty); }; return(base.DbOperation(operation)); }
public ActionResult Edit(CodeObjectModel codeObjectModel) { var result = codeObjectService.UpdateSingleCodeObject(codeObjectModel); var flag = result.Status == MessageStatus.Success ? true : false; var msg = result.Message; return(Json(new { flag = flag, msg = msg })); }
public MessageModel InsertSingleEntity(CodeObjectModel model) { Func <IEntityContext, string> operation = delegate(IEntityContext context) { model.ModifyID = UserManagement.CurrentUser.UserID; model.ModifyName = UserManagement.CurrentUser.UserName; model.ModifyTime = DateTime.Now; context.CodeObject.Add(model); context.SaveChanges(); return(string.Empty); }; return(base.DbOperation(operation)); }
/// <summary> /// 编辑单条CodeObject /// </summary> /// <param name="model">对象规则信息实体</param> /// <returns></returns> public MessageModel UpdateSingleCodeObject(CodeObjectModel model) { return(codeObjectAccess.UpdateSingleEntity(model)); }
/// <summary> /// 新增单条CodeObject /// </summary> /// <param name="model">对象规则信息实体</param> /// <returns></returns> public MessageModel InsertSingleCodeObject(CodeObjectModel model) { return(codeObjectAccess.InsertSingleEntity(model)); }