예제 #1
0
        private SelectList CreateShippingOptionList()
        {
            var shippingOptions = mShippingOptionRepository.GetAllEnabled();
            var cart            = mShoppingService.GetCurrentShoppingCart();

            var selectList = shippingOptions.Select(s =>
            {
                var shippingPrice = mPricingService.CalculateShippingOptionPrice(s, cart);
                var currency      = shippingPrice.Currency;

                return(new SelectListItem
                {
                    Value = s.ShippingOptionID.ToString(),
                    Text = $"{s.ShippingOptionDisplayName} ({currency.FormatPrice(shippingPrice.Price)})"
                });
            });

            return(new SelectList(selectList, "Value", "Text"));
        }