Example #1
0
 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));
 }
Example #2
0
 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());
     }
 }
Example #3
0
        public ActionResult EditReview(int id)
        {
            ReviewWeb toEdit = reviewsWeb.GetById(id);

            return(View(toEdit));
        }
Example #4
0
 // [HttpPost]
 public ActionResult DeleteReview(ReviewWeb toDelete)
 {
     restaurantRepo.DeleteReview(toDelete.Id);
     return(RedirectToAction("Index", "Restaurants"));
 }