Example #1
0
        public ActionResult Edit(Restaurant restaurant, int CuisineId)
        {
            if (CuisineId != 0)
            {
                _db.CuisineRestaurant.Add(new CuisineRestaurant()
                {
                    CuisineId = CuisineId, RestaurantId = restaurant.RestaurantId
                });
            }

            _db.Entry(restaurant).State = EntityState.Modified;
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(Restaurant restaurant, int CuisineId, int joinId)
        {
            if (CuisineId != 0)
            {
                var joinEntry = _db.CuisineRestaurant.FirstOrDefault(entry => entry.CuisineRestaurantId == joinId);
                _db.CuisineRestaurant.Remove(joinEntry);
                _db.CuisineRestaurant.Add(new CuisineRestaurant()
                {
                    CuisineId = CuisineId, RestaurantId = restaurant.RestaurantId
                });
            }
            _db.Entry(restaurant).State = EntityState.Modified;
            _db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Edit(Cuisine cuisine)
 {
     try
     {
         if (String.IsNullOrWhiteSpace(cuisine.Type))
         {
             throw new System.InvalidOperationException("invalid input");
         }
         else
         {
             _db.Entry(cuisine).State = EntityState.Modified;
             _db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex.Message));
     }
 }
 public ActionResult Edit(Cousine cousine)
 {
     _db.Entry(cousine).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Example #5
0
 public ActionResult Edit(Restaurant restaurant)
 {
     _db.Entry(restaurant).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(Review review)
 {
     _db.Entry(review).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", "Restaurants", new { id = review.RestaurantId }));
 }