Beispiel #1
0
        public async Task <UserModel> CreateUserAsync(UserModel createUserRequest)
        {
            try
            {
                createUserRequest.ShouldNotBeNull();
                createUserRequest.Email.ShouldNotBeNullOrWhiteSpace();
                createUserRequest.Name.ShouldNotBeNullOrWhiteSpace();
                createUserRequest.Department.ShouldNotBeNullOrWhiteSpace();
                createUserRequest.Password.ShouldNotBeNullOrWhiteSpace();

                var userId =
                    await _authProvider.CreateUserWithUsernameAndPasswordAsync(createUserRequest.Email,
                                                                               createUserRequest.Password);

                var user = createUserRequest.Map();
                user.Uid = userId;

                await _userRepository.CreateUserDetailsAsync(user);

                return(user.Map());
            }
            catch (ShouldAssertException e)
            {
                Console.WriteLine(e);
                throw;
            }
        }