public ActionResult Create(Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(product);
        }
        public ActionResult ProductView(int product_ID)
        {
            ViewBag.ProductRow = qEntity.Products.Where(x => x.product_ID == product_ID).ToList();
            ViewBag.quantity = ViewBag.ProductRow[0].quantity;
            ViewBag.quantity++;

            using (ProductEntities context = new ProductEntities())
            {
                Product productData = new Product();
                //this will allow you to query for the selected category ID
                var product = context.Products.Where(table => table.product_ID == product_ID).ToList();
                if (product != null)
                {
                    ViewBag.productImage = product[0].image;
                    ViewBag.productPrice = product[0].price;
                    ViewBag.productName = product[0].name;
                    ViewBag.productStarus = product[0].productStatus_ID;
                    ViewBag.productDescription = product[0].description;
                    ViewBag.product_ID = product[0].product_ID;
                    ViewBag.category_ID = product[0].category_ID;
                    int category_ID = product[0].category_ID;
                }
            }
            return View();
        }
 public ActionResult Products(int category_ID)
 {
     if (ModelState.IsValid)
     {
         using (ProductEntities context = new ProductEntities())
         {
             Product productData = new Product();
             //this will allow you to query for the selected category ID
             var product = context.Products.Where(table => table.category_ID == category_ID).ToList();
             if (product != null)
             {
                 ViewBag.productData = product;
                 return View();
             }
         }
     }
     return View();
 }
 public ActionResult ProductSearch(Product product)
 {
     try
     {
         List<Product> productInfo = null;
         if (product.name != null)
         {
             using(ProductEntities pEntites = new ProductEntities())
             {
                 productInfo = pEntites.Products.Where(x => x.name == product.name).ToList();
             }
             return RedirectToAction("ProductView", "Product", new { product_id = productInfo[0].product_ID });
         }
        }catch(Exception ex)
        {
        return RedirectToAction("Index","Home");
        }
        return RedirectToAction("Index","Home");
 }
 public ActionResult Edit(Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(product);
 }