public ActionResult About() { ViewBag.Message = "Your app description page."; var model = new Review() { Name = "Tersiguel's", Rating = 9 }; return View(model); }
public ActionResult Edit(Review review) { if (ModelState.IsValid) { _db.Entry(review).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Index"); } review = _db.Reviews.Find(review.Id); return View(review); }
public ActionResult Create(int restaurantID, Review newReview) { try { var restaurant = _db.Restaurants.Single(r => r.ID == restaurantID); restaurant.Reviews.Add(newReview); _db.SaveChanges(); return RedirectToAction("Index1"); } catch { return View(); } }