public OperationResult ChangeEmployeeWithProfile(Profile profile) { var profileFromBdResult = profileHandler.Get(profile.Id); if (!profileFromBdResult.Ok) { return(OperationResult.BuildFromOperationResult(profileFromBdResult)); } dbContext.Entry(profileFromBdResult.ResultModel).CurrentValues.SetValues(profile); profileFromBdResult.ResultModel.Employee = profile.Employee; var attachResult = AttachEmployeerIfNeeded(profileFromBdResult.ResultModel); if (!attachResult.Ok) { return(attachResult); } dbContext.Update(profileFromBdResult.ResultModel); dbContext.SaveChanges(); return(OperationResult.BuildSuccess()); }
public OperationResult Add(T value) {//verification? dbContext.Add(value); dbContext.SaveChanges(); return(OperationResult.BuildSuccess()); }