public BusinessOperationResult <bool> CreateNew(User user) { BusinessValidationResult results = userValidator.ValidateForCreate(user); if (!results.IsValid) { return(BusinessOperationResult.CreateNewBoolean(results)); } //Everything fine accountContext.Users.Create(user); accountContext.SaveChanges(); //Success return(new BusinessOperationResult <bool>(true)); }
public BusinessOperationResult <bool> Update(User user) { BusinessValidationResult results = userValidator.ValidateForUpdate(user); if (!results.IsValid) { return(BusinessOperationResult.CreateNewBoolean(results)); } //Everything fine accountContext.Users.Update(user); //Getting into this indicates there was an issue if (accountContext.SaveChanges() == 0) { return(BusinessOperationResult.CreateNewBooleanError(BusinessMessageSource.BusinessRule, Resources.UserNotFound)); } //Success return(new BusinessOperationResult <bool>(true)); }