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);
        }
        public void EditDeliveryAddressForAPI(DeliveryAddressView deliveryAddressView, string customerID)
        {
            DeliveryAddressModifyRequest request = new DeliveryAddressModifyRequest();

            request.Address = deliveryAddressView;
            request.CustomerIdentityToken = customerID;
            _customerService.ModifyDeliveryAddress(request);
        }
Example #3
0
        public async Task <IActionResult> EditDeliveryAddress(DeliveryAddressView deliveryAddressView)
        {
            DeliveryAddressModifyRequest request = new DeliveryAddressModifyRequest();

            request.Address       = deliveryAddressView;
            request.CustomerEmail = _cookieAuthentication.GetAuthenticationToken();

            _customerService.ModifyDeliveryAddress(request);

            return(await DeliveryAddresses());
        }
Example #4
0
        public ActionResult EditDeliveryAddress(DeliveryAddressView deliveryAddressView)
        {
            DeliveryAddressModifyRequest request = new DeliveryAddressModifyRequest();

            request.Address = deliveryAddressView;
            request.CustomerIdentityToken = _formsAuthentication.GetAuthenticationToken();

            _customerService.ModifyDeliveryAddress(request);

            return(DeliveryAddresses());
        }
Example #5
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);
        }