public ActionResult Edit(Restaurant restaurant) { try { restaurant.Reviews = applicationServices.GetRestaurantById(restaurant.RestaurantId).Reviews; applicationServices.UpdateAverageRating(restaurant); applicationServices.UpdateRestaurant(restaurant); return(RedirectToAction("Index")); } catch { return(View(restaurant)); } }
public ActionResult Edit(Restaurant restaurant) { if (ModelState.IsValid) { try { restaurant.Reviews = applicationServices.GetRestaurantById(restaurant.RestaurantId).Reviews; applicationServices.UpdateAverageRating(restaurant); applicationServices.UpdateRestaurant(restaurant); return(RedirectToAction("Index")); } catch { Debug.WriteLine("Not Working."); // log some problem return(HttpNotFound()); } } else { return(View()); } }