private ServiceResult <UserBaseDto> CreateNewUser(UserBaseDto entity, EncryptedPasswordData saltHash) { entity.PasswordSalt = saltHash.Salt; entity.PasswordHash = saltHash.Hash; var user = _repository.Add(_mapper.Map <User>(entity)); var userPreference = _userPreferencesRepository.Add(new UserPreferences { UserId = user.Id, ShrinkedSidebar = false }); _unitOfWork.Commit(); user.UserPreferencesId = userPreference.Id; _unitOfWork.Commit(); return(ServiceResult <UserBaseDto> .Success(_mapper.Map <UserBaseDto>(user))); }
private async Task <ServiceResult <UserBaseDto> > UnDeleteExistingUserAsync(User possibleUserExistResult, EncryptedPasswordData saltHash) { possibleUserExistResult.PasswordHash = saltHash.Hash; possibleUserExistResult.PasswordSalt = saltHash.Salt; possibleUserExistResult.IsDeleted = false; _repository.Edit(_mapper.Map <User>(possibleUserExistResult)); await _unitOfWork.CommitAsync(); return(ServiceResult <UserBaseDto> .Success(_mapper.Map <UserBaseDto>(possibleUserExistResult))); }