コード例 #1
0
            public async Task <Unit> Handle(DeleteUserCommand request, CancellationToken cancellationToken)
            {
                ApplicationUser userToDelete = await _userStorage.FindByIdAsync(request.UserId)
                                               .ConfigureAwait(false)
                                               ?? throw new NotFoundException(nameof(ApplicationUser), request.UserId);

                IIdentityResult identityResult = await _userStorage.DeleteAsync(userToDelete)
                                                 .ConfigureAwait(false);

                identityResult.ThrowIfFailed();

                return(Unit.Value);
            }