public async Task <bool> Handle(string clientId, CancellationToken cancellationToken) { var client = await _oauthClientRepository.FindOAuthClientById(clientId, cancellationToken); if (client == null) { _logger.LogError($"Client cannot be deleted because the client '{clientId}' doesn't exist"); throw new OAuthClientNotFoundException(ErrorCodes.INVALID_REQUEST, string.Format(ErrorMessages.UNKNOWN_CLIENT, clientId)); } await _oauthClientRepository.Delete(client, cancellationToken); await _oauthClientRepository.SaveChanges(cancellationToken); _logger.LogInformation($"The client '{clientId}' has been removed"); return(true); }
public static void Delete(int id) { var client = GetClientById(id); repository.Delete(client); }