public DeliveryAddressModifyResponse ModifyDeliveryAddress(
            DeliveryAddressModifyRequest request)
        {
            DeliveryAddressModifyResponse response =
                new DeliveryAddressModifyResponse();

            Customer customer = _customerRepository
                                .FindBy(request.CustomerIdentityToken);

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

            if (deliveryAddress != null)
            {
                UpdateDeliveryAddressFrom(request.Address, deliveryAddress);

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

            response.DeliveryAddress = deliveryAddress
                                       .ConvertToDeliveryAddressView();

            return(response);
        }
Exemple #2
0
        public DeliveryAddressModifyResponse ModifyDeliveryAddress(DeliveryAddressModifyRequest request)
        {
            DeliveryAddressModifyResponse response = new DeliveryAddressModifyResponse();
            Customer        customer        = _customerRepository.FindBy(request.CustomerEmail);
            DeliveryAddress deliveryAddress = customer.DeliveryAddressBook.FirstOrDefault(d => d.Id == request.Address.Id);

            if (deliveryAddress != null)
            {
                UpdateDeliveryAddressFrom(request.Address, deliveryAddress);
                _customerRepository.Save(customer);
                _uow.Commit();
            }

            response.DeliveryAddress = _mapper.Map <DeliveryAddress, DeliveryAddressView>(deliveryAddress);

            return(response);
        }