//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)); }
/// <summary> /// Returns a shipping option with the specified identifier. /// </summary> /// <param name="shippingOptionId">Shipping option's identifier.</param> /// <returns><see cref="ShippingOptionInfo"/> object representing a shipping option with the specified identifier. Returns <c>null</c> if not found.</returns> public ShippingOptionInfo GetById(int shippingOptionId) { return(RepositoryCacheHelper.CacheObject(() => { var shippingInfo = shippingOptionInfoProvider.Get(shippingOptionId); if (shippingInfo == null || shippingInfo.ShippingOptionSiteID != SiteContext.CurrentSiteID) { return null; } return shippingInfo; }, $"{nameof(KenticoShippingOptionRepository)}|{nameof(GetById)}|{shippingOptionId}")); }