public ActionResult Create(Product product)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.Products.Add(product);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
         return View(product);
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Delete(int id, Product prod)
 {
     Product product = new Product();
     try
     {
         if (id == null)
             return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
         product = db.Products.Find(id);
         if (product == null)
             return HttpNotFound();
         db.Products.Remove(product);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
     return View(product);
 }
 public ActionResult Edit( Product product)
 {
     try
     {
         // TODO: Add update logic here
         if (ModelState.IsValid)
         {
             db.Entry(product).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index");
         }
         View(product);
     }
     catch
     {
         return View();
     }
     return View();
 }