Ejemplo n.º 1
0
        // GET: Products
        //Main: ViewProducts
        public ActionResult ViewProducts(int Id, string sessionId, int productId, int quantity)
        {
            //send to view;
            ViewData["sessionId"] = sessionId;
            ViewData["Id"]        = Id;
            ViewData["productId"] = productId;
            ViewData["quantity"]  = quantity;

            //To obtain user information at top partial view and send to View
            PartialViewUserProfile(sessionId);
            PartialViewCartCount();

            //only if there is productId and quantity change then update the cart
            if (productId != 0 || quantity != 0)
            {
                AddtoOrder(sessionId, productId, quantity);
                CountCartUpdate(sessionId);
            }

            //send to View
            List <Products> products = ProductsData.GetAllProducts();

            ViewData["products"] = products;


            return(View());
        }
Ejemplo n.º 2
0
        public List <Products> GetAllProducts()
        {
            ProductsData pd = new ProductsData();

            return(pd.GetAllProducts());
        }