// Adding to shopping Cart

        public ActionResult AddCart(Products_174772 pd)
        {
            if (Session["cart"] == null)
            {
                //List<Item> cart = new List<Item>();
                //cart.Add(new Item(db.Products_174772.Find(productId),1));
                //Session["cart"] = cart;
                //Session["count"] = 1;

                List <Products_174772> cart = new List <Products_174772>();

                cart.Add(pd);
                Session["cart"] = cart;
                ViewBag.cart    = cart.Count();


                Session["count"] = 1;
            }

            else
            {
                List <Products_174772> cart = (List <Products_174772>)Session["cart"];
                cart.Add(pd);
                Session["cart"]  = cart;
                ViewBag.cart     = cart.Count();
                Session["count"] = Convert.ToInt32(Session["count"]) + 1;
            }

            return(RedirectToAction("Index1", "ShoppingCart"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Products_174772 products_174772 = db.Products_174772.Find(id);

            db.Products_174772.Remove(products_174772);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ProductId,CategoryId,ModelNumber,ModelName,UnitCost,Description")] Products_174772 products_174772)
 {
     if (ModelState.IsValid)
     {
         db.Entry(products_174772).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories_174772, "CategoryId", "CategoryName", products_174772.CategoryId);
     return(View(products_174772));
 }
        // GET: Products/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Products_174772 products_174772 = db.Products_174772.Find(id);

            if (products_174772 == null)
            {
                return(HttpNotFound());
            }
            return(View(products_174772));
        }
        // GET: Products/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Products_174772 products_174772 = db.Products_174772.Find(id);

            if (products_174772 == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryId = new SelectList(db.Categories_174772, "CategoryId", "CategoryName", products_174772.CategoryId);
            return(View(products_174772));
        }