public async Task <bool> Handle(SaveClientClaimCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(false); } var savedClient = await _clientRepository.GetByClientId(request.ClientId); if (savedClient == null) { await Bus.RaiseEvent(new DomainNotification("Client", "Client not found")); return(false); } var property = request.ToEntity(savedClient); _clientClaimRepository.Add(property); if (await Commit()) { await Bus.RaiseEvent(new NewClientClaimEvent(request.Id, request.ClientId, property.Type, property.Value)); return(true); } return(false); }
public async Task Handle(SaveClientClaimCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return; } var savedClient = await _clientRepository.GetByClientId(request.ClientId); if (savedClient == null) { await Bus.RaiseEvent(new DomainNotification("1", "Client not found")); return; } var property = new ClientClaim() { Client = savedClient, Value = request.Value, Type = request.Type }; _clientClaimRepository.Add(property); if (Commit()) { await Bus.RaiseEvent(new NewClientClaimEvent(request.Id, request.ClientId, property.Type, property.Value)); } }