public virtual async Task <IHttpActionResult> GetRecurringOrderTemplatesAddressesAsync([FromBody] GetRecurringTemplateAddressRequest request)
        {
            var recurringOrderScheduleUrl = RecurringScheduleUrlProvider.GetRecurringScheduleDetailsUrl(new GetRecurringScheduleDetailsUrlParam
            {
                CultureInfo         = ComposerContext.CultureInfo,
                RecurringScheduleId = request.Id
            });

            var addAddressUrl = MyAccountUrlProvider.GetAddAddressUrl(new BaseUrlParameter {
                CultureInfo = ComposerContext.CultureInfo, ReturnUrl = recurringOrderScheduleUrl
            });
            var editAddressBaseUrl = MyAccountUrlProvider.GetUpdateAddressBaseUrl(new BaseUrlParameter {
                CultureInfo = ComposerContext.CultureInfo, ReturnUrl = recurringOrderScheduleUrl
            });

            var viewModel = await CustomerAddressViewService.GetAddressListViewModelAsync(new GetAddressListViewModelParam
            {
                CustomerId         = ComposerContext.CustomerId,
                CultureInfo        = ComposerContext.CultureInfo,
                Scope              = ComposerContext.Scope,
                AddAddressUrl      = addAddressUrl,
                EditAddressBaseUrl = editAddressBaseUrl,
                CountryCode        = ComposerContext.CountryCode
            });

            return(Ok(viewModel));
        }
        public virtual async Task <IHttpActionResult> GetRecurringCartAddressAsync([FromBody] GetRecurringCartAddressRequest request)
        {
            if (request == null)
            {
                return(BadRequest("Missing Request Body"));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var cartsUrl = RecurringCartUrlProvider.GetRecurringCartDetailsUrl(new GetRecurringCartDetailsUrlParam {
                CultureInfo       = ComposerContext.CultureInfo,
                RecurringCartName = request.CartName
            });

            var addAddressUrl = MyAccountUrlProvider.GetAddAddressUrl(new BaseUrlParameter {
                CultureInfo = ComposerContext.CultureInfo, ReturnUrl = cartsUrl
            });
            var editAddressBaseUrl = MyAccountUrlProvider.GetUpdateAddressBaseUrl(new BaseUrlParameter {
                CultureInfo = ComposerContext.CultureInfo, ReturnUrl = cartsUrl
            });

            var viewModel = await CustomerAddressViewService.GetAddressListViewModelAsync(new GetAddressListViewModelParam
            {
                CustomerId         = ComposerContext.CustomerId,
                CultureInfo        = ComposerContext.CultureInfo,
                Scope              = ComposerContext.Scope,
                AddAddressUrl      = addAddressUrl,
                EditAddressBaseUrl = editAddressBaseUrl,
                CountryCode        = ComposerContext.CountryCode
            });

            return(Ok(viewModel));
        }
        //TODO: Change the method name for GetAdressListAsync or something similar because it confuse people
        public virtual async Task <IHttpActionResult> GetShippingAddressAsync()
        {
            var checkoutAddressStepUrl = CartUrlProvider.GetCheckoutStepUrl(new GetCheckoutStepUrlParam
            {
                CultureInfo = ComposerContext.CultureInfo,
                StepNumber  = 1,
            });


            var urlParam = new BaseUrlParameter {
                CultureInfo = ComposerContext.CultureInfo,
                ReturnUrl   = checkoutAddressStepUrl
            };
            var addressListUrl     = MyAccountUrlProvider.GetAddressListUrl(urlParam);
            var addAddressUrl      = CartUrlProvider.GetCheckoutAddAddressUrl(urlParam);
            var editAddressBaseUrl = CartUrlProvider.GetCheckoutUpdateAddressBaseUrl(urlParam);

            var viewModel = await CustomerAddressViewService.GetAddressListViewModelAsync(new GetAddressListViewModelParam
            {
                CustomerId         = ComposerContext.CustomerId,
                CultureInfo        = ComposerContext.CultureInfo,
                Scope              = ComposerContext.Scope,
                AddAddressUrl      = addAddressUrl,
                EditAddressBaseUrl = editAddressBaseUrl,
                CountryCode        = ComposerContext.CountryCode
            });

            return(Ok(viewModel));
        }
예제 #4
0
        //TODO: Change the method name for GetAdressListAsync or something similar because it confuse people
        public virtual async Task <IHttpActionResult> GetShippingAddressAsync()
        {
            var viewModel = await CustomerAddressViewService.GetAddressListViewModelAsync(new GetAddressListViewModelParam
            {
                CustomerId  = ComposerContext.CustomerId,
                CultureInfo = ComposerContext.CultureInfo,
                Scope       = ComposerContext.Scope,
                CountryCode = ComposerContext.CountryCode
            });

            return(Ok(viewModel));
        }
        public virtual ActionResult AddressList()
        {
            var urlParam = new BaseUrlParameter
            {
                CultureInfo = ComposerContext.CultureInfo
            };
            var addAddressUrl      = MyAccountUrlProvider.GetAddAddressUrl(urlParam);
            var editAddressBaseUrl = MyAccountUrlProvider.GetUpdateAddressBaseUrl(urlParam);

            var viewModel = CustomerAddressViewService.GetAddressListViewModelAsync(new GetAddressListViewModelParam
            {
                CustomerId         = ComposerContext.CustomerId,
                CultureInfo        = ComposerContext.CultureInfo,
                Scope              = ComposerContext.Scope,
                AddAddressUrl      = addAddressUrl,
                EditAddressBaseUrl = editAddressBaseUrl,
                CountryCode        = ComposerContext.CountryCode
            }).Result;

            return(View("AddressListBlade", viewModel));
        }