public async Task <User> AddNewUser(UserBuilderParams userBuilderParams) { var userBuilder = new UserBuilder(userBuilderParams, _roomRepository); var userBuilderDirector = new UserBuilderDirector { Builder = userBuilder }; userBuilderDirector.BuildUser(userBuilderParams.UserTypeId); var user = userBuilder.GetResult(); var savedUser = _userRepository.AddUser(user); if (!await _userRepository.UnitOfWork.SaveEntitiesAsync()) { throw new Exception("Something went wrong during adding new user"); } ; await _notificationService.SendTextMessage((int)ActionType.ManageUsers, $"New User with Id {user.Id} added"); return(savedUser); }
public UserBuilder(UserBuilderParams builderParams, IRoomRepository roomRepository) { BuilderParams = builderParams; _roomRepository = roomRepository; }