コード例 #1
0
 public ActionResult Edit(Review review)
 {
     if (ModelState.IsValid)
     {
         db.Entry(review).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TouristAttractionId = new SelectList(db.TouristAttractions, "TouristAttractionId", "Name", review.TouristAttractionId);
     return View(review);
 }
コード例 #2
0
        public ActionResult Create(Review review)
        {
            if (ModelState.IsValid)
            {
                db.Reviews.Add(review);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TouristAttractionId = new SelectList(db.TouristAttractions, "TouristAttractionId", "Name", review.TouristAttractionId);
            return View(review);
        }