public async Task <bool> Handle(RemoveClientCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(false); } var client = await _clientRepository.FindByClientIdAsync(request.Client.ClientId); if (client == null) { await _bus.RaiseEvent(new DomainNotification("key_not_found", $"Client with ClientId {request.Client.ClientId} not found")); return(false); } await _clientRepository.RemoveAsync(client); if (Commit()) { await _bus.RaiseEvent(new ClientRemovedEvent(client.ClientId)); return(true); } return(false); }
public async Task Handle(RemoveClientCommand message) { if (!message.IsValid()) { NotifyValidationErrors(message); return; } await _clientRepository.DeleteLogicAsync(message.Id.ToString()); }
public async Task Remove(RemoveClientCommand removeClientCommand) { await _bus.SendCommand(removeClientCommand); }
public void Remove(Guid id) { var removeCommand = new RemoveClientCommand(id); mediatorHandler.SendCommand(removeCommand); }
public async Task RemoveAsync(string clientId) { var command = new RemoveClientCommand(clientId); await _bus.SendCommand(command); }