コード例 #1
0
 public ActionResult Edit(RestaurantReview review)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(review).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index", new { id = review.RestaurantId });
     }
     return View(review);
 }
コード例 #2
0
 public ActionResult Create(RestaurantReview review)
 {
     if(ModelState.IsValid)
     {
         _db.Reviews.Add(review);
         _db.SaveChanges();
         return RedirectToAction("Index", new { id = review.RestaurantId });
     }
     return View(review);
 }