public IActionResult Complete(int ID) { Restaurant restaurantToComplete = context.Restaurants.First(c => c.ID == ID); RateRestaurantViewModel rateRestaurantViewModel = new RateRestaurantViewModel(); rateRestaurantViewModel.Name = restaurantToComplete.Name; rateRestaurantViewModel.Notes = restaurantToComplete.Notes; rateRestaurantViewModel.ID = restaurantToComplete.ID; return(View(rateRestaurantViewModel)); }
public IActionResult RateRestaurant(RateRestaurantViewModel rateRestaurantViewModel) { int ID = rateRestaurantViewModel.ID; Restaurant ratedRestaurant = context.Restaurants.First(C => C.ID == ID); ratedRestaurant.Rating = rateRestaurantViewModel.Rating; ratedRestaurant.Notes = rateRestaurantViewModel.Notes; ratedRestaurant.RestaurantStatus = Status.CompletionStatus.Complete; context.Restaurants.Update(ratedRestaurant);; context.Restaurants.Update(ratedRestaurant); context.SaveChanges(); return(Redirect("/Restaurant")); }