示例#1
0
        public ActionResult Basket()
        {
            var claimIdentity = User.Identity as ClaimsIdentity;
            var idstYet       = claimIdentity.FindAll(ClaimTypes.UserData);// List of the products id

            ModelState.Clear();

            ProductsDb     dbProducts       = new ProductsDb();
            List <Product> listProductFound = new List <Product>();
            Product        productFound;

            // Search all products id in the auth cookie
            foreach (var id in idstYet)
            {
                // Don't take the first because it's ""
                if (id.Value != "")
                {
                    // Find the product in DB
                    productFound = dbProducts.GetProductsDetail(Convert.ToInt32(id.Value)).Item1;
                    if (productFound != null)
                    {
                        listProductFound.Add(productFound);
                    }
                }
            }

            return(View(listProductFound));
        }
示例#2
0
        public ActionResult DeleteProduct(int id)
        {
            ProductsDb dbProduct = new ProductsDb();

            ModelState.Clear();
            return(View(dbProduct.GetProductsDetail(id)));
        }