示例#1
0
        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";
            var model = new Review()
            {
                Name = "Tersiguel's",
                Rating = 9

            };

            return View(model);
        }
示例#2
0
        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);
        }
示例#3
0
 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();
     }
 }