public ActionResult Create(FormCollection collection, int id) { if (ModelState.IsValid) { try { Review temp = new Review { RestaurantID = id, ReviewerName = collection["reviewerName"], ReviewScore = (float)Convert.ToDouble(collection["reviewScore"]), ReviewText = collection["reviewText"] }; LibHelper.AddReview(temp); return(RedirectToAction("ListReviews/" + id)); } catch (Exception e) { return(View()); } } else { return(View("Model State is invalid.")); } }
//add a review for a restaurant public void AddReview(Review review) { _db.AddReview(ToDataRev(review)); Debug.Write("Added 1 Review"); }