public async Task <IdentityResult> CreateAsync(Role role, CancellationToken cancellationToken)
        {
            _roleRepository.Add(role);

            await _dapperTransactionService.RunOperations(cancellationToken);

            return(IdentityResult.Success);
        }
예제 #2
0
        public async Task <IdentityResult> CreateAsync(User user, CancellationToken cancellationToken)
        {
            try
            {
                _userRepository.Add(user);

                await _dapperTransactionService.RunOperations(cancellationToken);

                return(IdentityResult.Success);
            }
            catch (DuplicateUserNameException)
            {
                return(IdentityResult.Failed(_identityErrorDescriber.DuplicateUserName(user.UserName)));
            }
        }