public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request)
        {
            DeliveryAddressAddResponse response = new DeliveryAddressAddResponse();
            Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken);

            Address address = ConvertToAddress(request.Address);

            customer.AddAddress(address, request.Address.Name);

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

            //response.DeliveryAddress = deliveryAddress.ConvertToDeliveryAddressView();

            return response;
        }
Esempio n. 2
0
        public DeliveryAddressAddResponse AddDeliveryAddress(DeliveryAddressAddRequest request)
        {
            DeliveryAddressAddResponse response = new DeliveryAddressAddResponse();
            Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken);
            DeliveryAddress deliveryAddress = new DeliveryAddress();

            deliveryAddress.Customer = customer;
            UpdateDeliveryAddressFrom(request.Address, deliveryAddress);

            customer.AddAddress(deliveryAddress);

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

            response.DeliveryAddress = deliveryAddress.ConvertToDeliveryAddressView();

            return response;
        }