public void EditReview(int id, Review r) { //var rest = RRRavesDBEntities.Set<Review>().Single(i => i.ID_Review == id); //if (rest != null) //{ // rest.Rating = r.Rating; // rest.ReviewText = r.ReviewText; //} var oldReview = RRRavesDBEntities.Reviews.Find(id); var oldRate = oldReview.Rating; RRRavesDBEntities.Entry(oldReview).CurrentValues.SetValues(r); this.AverageRatingsEdit(r.Restaurant.Value, oldRate, r.Rating); }
public void EditRestaurant(int id, Restaurant restaurant) { //var rest = RRRavesDBEntities.Set<Restaurant>().Single(i => i.ID_Restaurant == id); //if (rest != null) //{ // rest.Name = restaurant.Name; // rest.Address = restaurant.Address; // rest.City = restaurant.City; // rest.Zipcode = restaurant.Zipcode; // rest.Phone = restaurant.Phone; // rest.Website = restaurant.Website; //} var oldRest = RRRavesDBEntities.Restaurants.Find(id); RRRavesDBEntities.Entry(oldRest).CurrentValues.SetValues(restaurant); }