예제 #1
0
        public void Execute(DeliveryAddressModifyCommand command)
        {
            Customer customer = _customerRepository.FindBy(command.CustomerIdentityToken);

            DeliveryAddress deliveryAddress =
                customer.DeliveryAddressBook.Where(d => d.Id == command.Address.Id).FirstOrDefault();

            if (deliveryAddress != null)
            {
                deliveryAddress.ChangeNameTo(command.Address.Name);

                var address = ConvertToAddressFrom(command.Address);

                deliveryAddress.ChangeAddressTo(address);

                _customerRepository.Save(customer);
                _uow.Commit();
            }
        }