public MessageModel UpdateSingleEntity(BreedLogModel model) { Func <IEntityContext, string> operation = (context => { var data = context.BreedLog.FirstOrDefault(m => m.BreedID == model.BreedID && m.ModifyTime == model.ModifyTime); if (data == null) { return("当前数据不存在或被更新,请刷新后再次操作!"); } data.LogID = model.LogID; data.CultivationID = model.CultivationID; data.BreedID = model.BreedID; data.AreaID = model.AreaID; data.HomeID = model.HomeID; data.CultivationEpc = model.CultivationEpc; data.BatchCode = model.BatchCode; data.Remark = model.Remark; data.IsLocked = model.IsLocked; data.IsShow = model.IsShow; data.ModifyID = UserManagement.CurrentUser.UserID; data.ModifyName = UserManagement.CurrentUser.UserName; data.ModifyTime = DateTime.Now; context.SaveChanges(); return(string.Empty); }); return(base.DbOperation(operation)); }
public MessageModel InsertSingleEntity(BreedLogModel model) { Func <IEntityContext, string> operation = (context => { model.ModifyID = UserManagement.CurrentUser.UserID; model.ModifyName = UserManagement.CurrentUser.UserName; model.ModifyTime = DateTime.Now; context.BreedLog.Add(model); context.SaveChanges(); return(string.Empty); }); return(base.DbOperation(operation)); }
/// <summary> /// 编辑单条BreedLog /// </summary> /// <param name="model"></param> /// <returns></returns> public MessageModel UpdateSingleBreedLog(BreedLogModel model) { var data = breedLogAccess.GetOriEntity(model.LogID, model.ModifyTime); if (data == null) { return new MessageModel() { Message = "当前数据不存在或被更新,请刷新后再次操作!", Status = MessageStatus.Error } } ; return(breedLogAccess.UpdateSingleEntity(model)); } }
/// <summary> /// 插入单条BreedLog /// </summary> /// <param name="model"></param> /// <returns></returns> public MessageModel InsertSingleBreedLog(BreedLogModel model) { return(breedLogAccess.InsertSingleEntity(model)); }