예제 #1
0
        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 ActionResult EditDeliveryAddress(DeliveryAddressView deliveryAddressView)
        {
            DeliveryAddressModifyRequest request = new DeliveryAddressModifyRequest();
            request.Address = deliveryAddressView;
            request.CustomerIdentityToken = _formsAuthentication.GetAuthorisationToken();

            _customerService.ModifyDeliveryAddress(request);

            return DeliveryAddresses();
        }