public void Handle(UpdateClientAddressCommand command) { Client client = _clientRepository.GetEntity(command.ClientId); client = client.UpdateAddress(command.Adresse); _clientRepository.SaveAggregateEvents(client); }
public void Handle(CreateClientCommand command) { Client client = _clientRepository.GetEntity(command.ClientId); if (client != null) { throw new InvalidOperationException($"Client already exists with this Id {command.ClientId}"); } client = Client.Create(command.ClientId, command.FirstName, command.LastName, command.adresse); _clientRepository.SaveAggregateEvents(client); }