private Tuple<List<basketItem>, basketActionResult> getBasketListByTblBasket(List<tbl_basket> list,bool isDeletedInclude)
        {
            productShared pc = new productShared(db);

            basketActionResult basketAction = basketActionResult.success;
            List<basketItem> helperList = new List<basketItem>();

            foreach (var item in list)
            {
                basketItem helperItem = new basketItem();
                var productItem = item.tbl_product;

                // delete Basket
                if (productItem == null || productItem.statu == false || productItem.isDeleted)
                {
                    deleteBasketById(item.basketId);
                    return new Tuple<List<basketItem>, basketActionResult>(null, basketActionResult.redirect);

                }

                if (item.quantity < 1)
                {
                    deleteBasketById(item.basketId);
                    return new Tuple<List<basketItem>, basketActionResult>(null, basketActionResult.redirect);
                }

                //option
                var optionList = pc.getOptionListByProductItem(productItem);
                if (optionList != null && optionList.Count > 0)
                {
                    // delete Basket
                    if (!pc.isProductOptionValid(optionList, item.optionList, isDeletedInclude))
                    {
                        deleteBasketById(item.basketId);
                        return new Tuple<List<basketItem>, basketActionResult>(null, basketActionResult.redirect);
                    }

                    // Renk Seçimi Metalik
                    helperItem.optionItemList = getBasketOptionListByOptionStr(optionList, item.optionList);
                    helperItem.optionCode = item.optionList;
                }

                // stock
                int stockCount = pc.getProductStockAvailableCount(item.productId, item.optionList);
                if (stockCount < 1)
                {
                    deleteBasketById(item.basketId);
                    return new Tuple<List<basketItem>, basketActionResult>(null, basketActionResult.redirect);
                }

                if (stockCount < item.quantity)
                {
                    helperItem.quantity = stockCount;
                    updateStockCount(item.basketId, stockCount);
                    basketAction = basketActionResult.stockAdjust;
                }
                else
                {
                    helperItem.quantity = item.quantity;
                }

                // name
                helperItem.description = productItem.name;

                // price
                helperItem.productPriceDec = pc.calcPriceProduct(productItem);
                helperItem.productTotalPriceDec = helperItem.productPriceDec * helperItem.quantity;

                // image
                var photoItem = pc.getProductGallery(productItem, "110", "74").Where(a => a.Item2 == item.optionList).FirstOrDefault();
                if (photoItem != null)
                {
                    helperItem.photo = photoItem.Item1;
                }

                // discount
                helperItem.discountCode = item.discountCode;

                // basketId
                helperItem.basketId = item.basketId;

                // productId
                helperItem.productId = item.productId;

                helperList.Add(helperItem);

            }

            return new Tuple<List<basketItem>, basketActionResult>(helperList, basketAction);
        }
        public ActionResult Detail(int productId, int carModelId, int carBrandId, string parentUrl, string parentName)
        {
            helperProductDetail helperPage = new helperProductDetail();

            var productItem = db.tbl_product.Include("tbl_stock").Include("tbl_gallery").Include("tbl_productCritear.tbl_critear").Where(a => a.productId == productId).FirstOrDefault();
            var carBrandItem = db.tbl_carBrand.Where(a => a.carBrandId == carBrandId).FirstOrDefault();
            var carModelItem = db.tbl_carModel.Include("tbl_carModelProduct.tbl_product.tbl_stock").Where(a => a.carModelId == carModelId).FirstOrDefault();

            var baseUrl = mainPath + langCode + "/" + parentUrl + "/" + carBrandItem.url + "/" + carModelItem.url;

            // statu Control
            if (productItem.statu == false)
            {
                return RedirectPermanent(baseUrl + ".html");
            }

            // stockControl
            if (!productItem.tbl_stock.Any(a => a.stockCount > 0))
            {
                return RedirectPermanent(baseUrl + ".html");
            }

            //PrevAndNextUrl
            var productList = carModelItem.tbl_carModelProduct.Select(a => a.tbl_product).Where(a => a != null && a.statu && a.tbl_stock.Any(b => b.stockCount > 0)).OrderBy(a => a.sequence).ToList();

            var sequenceCurrenProduct = productList.IndexOf(productItem);
            helperPage = getPrevAndNextUrl(helperPage, sequenceCurrenProduct, productList, baseUrl);

            //backLink
            helperPage.backLink = baseUrl + ".html";
            if (Request.QueryString["page"] != null)
            {
                // ToDo: Add Pageing Back Link
            }

            productShared pc = new productShared(db);
            CultureInfo priceFormat = CultureInfo.CreateSpecificCulture(langCulture);

            //breadcrumb
            helperPage.breadCrumbItem = getProductDetailBreadCrumbProductList(parentName, parentUrl, carBrandItem.name, carBrandItem.url, carModelItem.name, carModelItem.url, productItem.name);

            helperPage.imageList = pc.getProductGallery(productItem, "500", "350");
            helperPage.productName = productItem.name;
            helperPage.productId = productItem.productId;

            decimal price = pc.calcPriceProduct(productItem);
            helperPage.price = price.ToString("F2", priceFormat) + " TL";

            var taxpriceItem = pc.getProductWithoutTaxPriceAndTaxPrice(productItem, priceFormat);
            helperPage.withoutTaxPrice = taxpriceItem.Item2;

            helperPage.detail = productItem.detail;

            //OptionList
            helperPage.optionList = pc.getOptionListByProductItem(productItem);

            if (Request.QueryString["action"] != null && Request.QueryString["action"] == "optionSelect")
            {
                helperPage.isOptionMsgExist = true;
            }

            //Title
            var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault();
            if (settingItem != null)
            {
                helperPage.setBrowserTitle(helperPage.productName + settingItem.allPageTitle);
                helperPage.setDescription(productItem.metaDescription);
                helperPage.setKeywords(productItem.metaKeyword);
            }

            if (settingItem.isCrediCardEnable.HasValue && settingItem.isCrediCardEnable.Value)
            {
                helperPage.isInstallmenTableVisible = true;
            }

            return View(helperPage);
        }