//Edit a review object public void EditReview(Review item) { using (var db = new RestaurantDBEntities()) { Review review = new Review(); review = db.Reviews.Find(item.ID); review.Rating = item.Rating; review.CustName = item.CustName; db.Entry(review).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
//Edit a restaurant object public void EditRestaurant(Restaurant item) { using (var db = new RestaurantDBEntities()) { Restaurant restaurant = new Restaurant(); restaurant = db.Restaurants.Find(item.ID); restaurant.Name = item.Name; restaurant.FoodType = item.FoodType; restaurant.Address = item.Address; db.Entry(restaurant).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }