예제 #1
0
        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));
            }
        }
예제 #2
0
        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());
            }
        }