public IActionResult Cart(ViewStoreDetailModel Model)
        {
            _logger.LogInformation("AddToCart Controller: PostCart");

            var x = _repo.GetAllProducts().Where(a => a.ID == Model.ProductID).FirstOrDefault();
            /// pass to temp data
            ///
            Dictionary <Product, int> inven = new Dictionary <Product, int>();

            // pass Inventory
            try
            {
                Store   PrevStore = DeserObjectStore(TempData["store"].ToString());
                Product item      = PrevStore.ItemInventory.Where(f => f.Key.ID == x.ID).FirstOrDefault().Key;

                //validate same product



                if (PrevStore.ItemInventory[item] > Model.Quantity)
                {
                    PrevStore.ItemInventory[item] -= Model.Quantity;
                    TempData["Store"]              = SeriObject(PrevStore);
                    Model.ViewOrderModel.Product   = inven;
                    try
                    {
                        inven = DeserObjectOrderDetail(TempData.Peek("OrderDetail").ToString());
                        inven.Add(x, Model.Quantity);
                        string y = SeriObject(inven);
                        TempData["OrderDetail"] = y;
                    }
                    catch
                    {
                        inven.Add(x, Model.Quantity);
                        string y = SeriObject(inven);
                        TempData["OrderDetail"] = y;
                    }
                }
                else
                {
                    Model.errorMessage = "Amount request is greater than inventory.";
                }


                //end pass

                Model.Store = PrevStore;

                return(View(Model));
            }
            catch
            {
                Model.errorMessage = "There is something with your purchase. Please wait. ";
                return(View(Model));
            }
        }
        public IActionResult StoreShop(ViewStoreDetailModel model)
        {
            _logger.LogInformation("AddToCart Controller: StoreShop");


            int   StoreID = model.Store.StoreID;
            Store st      = _repo.GetAllStores().Where(s => s.StoreID == StoreID).FirstOrDefault();



            ViewStoreDetailModel stor = new ViewStoreDetailModel();

            stor.Store = st;

            if (st == null)
            {
                return(RedirectToAction("Index", "Home"));
            }


            return(RedirectToAction("Index", "Home"));
        }
        public IActionResult Index(ViewStoreProductModel model = null, ViewOrderDetailsModel x = null)
        {
            _logger.LogInformation("AddToCart Controller: PostIndex");
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "Home"));
            }

            int    StoreID = model.StoreID;
            Store  st      = _repo.GetAllStores().Where(s => s.StoreID == StoreID).FirstOrDefault();
            string storeS  = SeriObject(st);

            TempData["store"] = storeS;

            ViewStoreDetailModel stor = new ViewStoreDetailModel();

            stor.Store = st;

            if (st == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(stor));
        }