public ActionResult AddProduct(int productId)
        {
            System.Threading.Thread.Sleep(2000);

            topCart cartItem = (topCart)ViewData["topCart"];

            basketShared bc = new basketShared(db);
            string returnMsg = "";
            string resultMsg = "";
            string cartHtml = "";
            string hostName = "";
            try
            {
                var result = bc.addProductBasket(productId, cartItem.userId, cartItem.guestGuid, null);

                switch (result)
                {
                    case productAddResult.added:
                        returnMsg = getSuccesMessage(lang.addBasketSuccess, null);
                        resultMsg = "success";
                        cartItem.productCount = cartItem.productCount + 1;
                        cartHtml = RenderRazorViewToString("topCart", cartItem);
                        break;
                    case productAddResult.hasOption:
                        returnMsg = null;
                        resultMsg = "option";
                        hostName = Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host +
             (Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port);
                        break;
                    case productAddResult.stockError:
                        returnMsg = getErrorMessage(lang.addBasketStockError, null);
                        resultMsg = "error";

                        break;
                    case productAddResult.statuError:
                        returnMsg = getErrorMessage(lang.addBasketStatu, null);
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                returnMsg = getErrorMessage(lang.unexpectedErrorMsg, null);
                resultMsg = "error";
                errorSend(ex, "Add Product List");

            }

            return Json(new { result = resultMsg, msgHtml = returnMsg, cartHtml = cartHtml, hostName = hostName });
        }
        public ActionResult AddProduct(int productId, string optionValueList)
        {
            System.Threading.Thread.Sleep(2000);

            topCart cartItem = (topCart)ViewData["topCart"];

            basketShared bc = new basketShared(db);

            optionValueList = bc.getOptionList(optionValueList);
            string returnMsg = "";
            string resultMsg = "";
            string cartHtml = "";

            var result = bc.addProductBasket(productId, cartItem.userId, cartItem.guestGuid, optionValueList);
            try
            {
                switch (result)
                {
                    case productAddResult.added:
                        returnMsg = getSuccesMessage(lang.addBasketSuccess, "mRight20 displayTable");
                        resultMsg = "success";
                        cartItem.productCount = cartItem.productCount + 1;
                        cartHtml = RenderRazorViewToString("topCart", cartItem);
                        break;

                    case productAddResult.stockError:
                        returnMsg = getErrorMessage(lang.addBasketStockError, "mRight20 displayTable");
                        resultMsg = "error";

                        break;
                    case productAddResult.statuError:
                        returnMsg = getErrorMessage(lang.addBasketStatu, "mRight20 displayTable");
                        resultMsg = "error";
                        break;

                }
            }

            catch (Exception ex)
            {
                returnMsg = getErrorMessage(lang.unexpectedErrorMsg, null);
                resultMsg = "error";
                errorSend(ex, "Add Product Detail");
            }

            return Json(new { result = resultMsg, msgHtml = returnMsg, cartHtml = cartHtml });
        }