Esempio n. 1
0
 /// <summary>
 /// Returns all available countries.
 /// </summary>
 /// <returns>Collection of all available countries</returns>
 public IEnumerable <CountryInfo> GetAllCountries()
 {
     return(RepositoryCacheHelper.CacheObjects(() =>
     {
         return countryInfoProvider.Get();
     }, $"{nameof(KenticoCountryRepository)}|{nameof(GetAllCountries)}"));
 }
Esempio n. 2
0
        //EndDocSection:CouponCodeRemove


        //DocSection:DisplayDelivery
        /// <summary>
        /// Displays the customer details checkout process step.
        /// </summary>
        public IActionResult DeliveryDetails()
        {
            // Gets the current user's shopping cart
            ShoppingCartInfo cart = shoppingService.GetCurrentShoppingCart();

            // If the shopping cart is empty, displays the shopping cart
            if (cart.IsEmpty)
            {
                return(RedirectToAction(nameof(ShoppingCart)));
            }

            // Gets all countries for the country selector
            SelectList countries = new SelectList(countryInfo.Get(), "CountryID", "CountryDisplayName");

            // Creates a collection of shipping options enabled for the current site
            SelectList shippingOptions = CreateShippingOptionList(cart);

            // Loads the customer details
            DeliveryDetailsViewModel model = new DeliveryDetailsViewModel
            {
                Customer       = new CustomerViewModel(shoppingService.GetCurrentCustomer()),
                BillingAddress = new BillingAddressViewModel(shoppingService.GetBillingAddress(), countries, null),
                ShippingOption = new ShippingOptionViewModel(shippingOption.Get(shoppingService.GetShippingOption()), shippingOptions)
            };

            // Displays the customer details step
            return(View(model));
        }
        public OrderAddressViewModel(OrderAddressInfo address, ICountryInfoProvider countryInfoProvider, IStateInfoProvider stateInfoProvider)
        {
            if (address == null)
            {
                return;
            }

            if (countryInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(countryInfoProvider));
            }
            if (stateInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(stateInfoProvider));
            }

            AddressLine1      = address.AddressLine1;
            AddressLine2      = address.AddressLine2;
            AddressCity       = address.AddressCity;
            AddressPostalCode = address.AddressZip;
            AddressState      = stateInfoProvider.Get(address.AddressStateID)?.StateDisplayName ?? String.Empty;
            AddressCountry    = countryInfoProvider.Get(address.AddressCountryID)?.CountryDisplayName ?? String.Empty;
        }
 public IEnumerable <Country> GetAll() => _countryInfoProvider
 .Get()
 .AsEnumerable()
 .Select(countryInfo => MapDtoProperties(countryInfo));