public ActionResult Rendering()
        {
            var shipmentPickerViewModel = new ShippingPickerViewModel();

            var basket          = _transactionLibraryInternal.GetBasket(false).PurchaseOrder;
            var shippingCountry = basket.GetAddress(Constants.DefaultShipmentAddressName).Country;

            shipmentPickerViewModel.ShippingCountry = shippingCountry.Name;
            var availableShippingMethods = _transactionLibraryInternal.GetShippingMethods(shippingCountry);

            shipmentPickerViewModel.SelectedShippingMethodId = basket.Shipments.FirstOrDefault() != null
                                ? basket.Shipments.FirstOrDefault().ShippingMethod.ShippingMethodId : -1;

            foreach (var availableShippingMethod in availableShippingMethods)
            {
                var price          = availableShippingMethod.GetPriceForCurrency(basket.BillingCurrency);
                var formattedprice = new Money((price == null ? 0 : price.Price), basket.BillingCurrency);

                shipmentPickerViewModel.AvailableShippingMethods.Add(new SelectListItem()
                {
                    Selected = shipmentPickerViewModel.SelectedShippingMethodId == availableShippingMethod.ShippingMethodId,
                    Text     = String.Format(" {0} ({1})", availableShippingMethod.Name, formattedprice),
                    Value    = availableShippingMethod.ShippingMethodId.ToString()
                });
            }

            return(View(shipmentPickerViewModel));
        }
        public virtual ShippingPickerViewModel GetViewModel()
        {
            var shipmentPickerViewModel = new ShippingPickerViewModel();
            var basket = _transactionLibraryInternal.GetBasket().PurchaseOrder;

            if (_transactionLibraryInternal.HasBasket())
            {
                var shippingCountry = basket.GetAddress(UCommerce.Constants.DefaultShipmentAddressName).Country;
                shipmentPickerViewModel.ShippingCountry = shippingCountry.Name;
                var availableShippingMethods = _transactionLibraryInternal.GetShippingMethods(shippingCountry);

                if (basket.Shipments.Count > 0)
                {
                    shipmentPickerViewModel.SelectedShippingMethodId = basket.Shipments.FirstOrDefault()?.ShippingMethod.ShippingMethodId ?? 0;
                }
                else
                {
                    shipmentPickerViewModel.SelectedShippingMethodId = -1;
                }

                foreach (var availableShippingMethod in availableShippingMethods)
                {
                    var priceGroup = SiteContext.Current.CatalogContext.CurrentPriceGroup;

                    var price          = availableShippingMethod.GetPriceForPriceGroup(priceGroup);
                    var formattedprice = new Money((price == null ? 0 : price.Price), basket.BillingCurrency);

                    shipmentPickerViewModel.AvailableShippingMethods.Add(new SelectListItem()
                    {
                        Selected = shipmentPickerViewModel.SelectedShippingMethodId == availableShippingMethod.ShippingMethodId,
                        Text     = String.Format(" {0} ({1})", availableShippingMethod.Name, formattedprice),
                        Value    = availableShippingMethod.ShippingMethodId.ToString()
                    });
                }
            }
            _transactionLibraryInternal.ExecuteBasketPipeline();

            shipmentPickerViewModel.NextStepUrl     = GetNextStepUrl(nextStepId);
            shipmentPickerViewModel.PreviousStepUrl = GetPreviousStepUrl(previousStepId);

            return(shipmentPickerViewModel);
        }