Example #1
0
 public ActionResult Edit(Restaurant restaurant)
 {
     try
     {
         _db.Entry(restaurant).State = EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Details", new { id = restaurant.RestaurantId }));
     }
     catch
     {
         return(RedirectToAction("Index", "Cuisine"));
     }
 }
Example #2
0
 public ActionResult Edit(Cuisine cuisine)
 {
     try
     {
         _db.Entry(cuisine).State = EntityState.Modified; //find and update all the entries for the properties of this specific instance
         //state (state of instance), is now equal to MODIFIED state..
         _db.SaveChanges();
         return(RedirectToAction("Details", new { id = cuisine.CuisineId }));
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
 }