示例#1
0
        public async Task CreateUserAsync(
            CreateUserCommand createUserCommand,
            CancellationToken cancellationToken)
        {
            var passwordHash = _encryptionService.EncodePassword(createUserCommand.Password);

            var user = UserFactory.Create(
                createUserCommand.Name,
                createUserCommand.LastName,
                passwordHash,
                createUserCommand.Email,
                createUserCommand.PhoneNumber,
                createUserCommand.PermissionLevel,
                createUserCommand.SquadId);

            await _userRepository.CreateAsync(user, cancellationToken);

            await _userRepository.SaveAsync(cancellationToken);
        }