public IActionResult Index()
        {
            List <BasketItemModel> basketItems = new List <BasketItemModel>();
            ShoppingCartSummary    cartSummary = GetCartSummary();
            BasketModel            model;

            BaseModelData modelData = GetModelData();

            if (cartSummary.Id != 0)
            {
                ShoppingCartDetail cartDetails = _shoppingCartProvider.GetDetail(cartSummary.Id);
                _stockProvider.GetStockAvailability(cartDetails.Items);

                foreach (ShoppingCartItem item in cartDetails.Items)
                {
                    basketItems.Add(new BasketItemModel(GetModelData(),
                                                        item.Id, item.Name, item.Description,
                                                        item.Size, item.SKU, item.ItemCost, (int)item.ItemCount,
                                                        item.StockAvailability > 500 ? "> 500" : item.StockAvailability.ToString(),
                                                        item.ItemCount * item.ItemCost, false, item.Images[0]));
                }

                if (TempData.ContainsKey("VoucherError"))
                {
                    ModelState.AddModelError(nameof(VoucherModel.Voucher), Languages.LanguageStrings.VoucherInvalid);
                    TempData.Remove("VoucherError");
                }

                modelData.ReplaceCartSummary(cartSummary);
                model = new BasketModel(modelData, basketItems,
                                        cartDetails.CouponCode, cartDetails.RequiresShipping,
                                        !String.IsNullOrEmpty(GetUserSession().UserEmail));
            }
            else
            {
                modelData.ReplaceCartSummary(cartSummary);
                model = new BasketModel(modelData, new List <BasketItemModel>(),
                                        String.Empty, false, GetUserSession().UserID != 0);
            }

            return(View(model));
        }
        public IActionResult Success(string provider)
        {
            UserSession session = GetUserSession();

            BaseModelData modelData = GetModelData();

            modelData.ReplaceCartSummary(new ShoppingCartSummary(0, 0, 0, 0, 0, GetDefaultTaxRate(),
                                                                 System.Threading.Thread.CurrentThread.CurrentUICulture,
                                                                 SharedPluginFeatures.Constants.CurrencyCodeDefault));

            PaymentSuccessModel model = new PaymentSuccessModel(modelData, (int)session.Tag);

            // clear basket data
            session.Tag          = null;
            session.UserBasketId = 0;
            CookieDelete(SharedPluginFeatures.Constants.ShoppingCart);

            return(View(model));
        }