public ActionResult EditReview(ReviewWeb toEdit) { if (ModelState.IsValid) { toEdit.Restaurant = reviewsWeb.GetById(toEdit.Id).Restaurant; restaurantRepo.UpdateReview(toEdit.ToLibLayer(toEdit.Restaurant.ToLibLayer())); return(RedirectToAction("Details", "Restaurants", toEdit.Restaurant)); } return(View(toEdit)); }
public ActionResult CreateReview(ReviewWeb newReviewWeb) { try { if (ModelState.IsValid) { object passedData; TempData.TryGetValue("restId", out passedData); int restId = (int)passedData; newReviewWeb.Restaurant = restaurantsWeb.GetById(restId); restaurantRepo.CreateReview(newReviewWeb.ToLibLayer(newReviewWeb.Restaurant.ToLibLayer())); return(RedirectToAction("Index")); } else { return(View(newReviewWeb)); } } catch { return(View()); } }
public ActionResult EditReview(int id) { ReviewWeb toEdit = reviewsWeb.GetById(id); return(View(toEdit)); }
// [HttpPost] public ActionResult DeleteReview(ReviewWeb toDelete) { restaurantRepo.DeleteReview(toDelete.Id); return(RedirectToAction("Index", "Restaurants")); }