コード例 #1
0
        public void Handle(UpdateClientAddressCommand command)
        {
            Client client = _clientRepository.GetEntity(command.ClientId);

            client = client.UpdateAddress(command.Adresse);

            _clientRepository.SaveAggregateEvents(client);
        }
コード例 #2
0
        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);
        }