コード例 #1
0
        public ActionResult Create(Question question)
        {
            if (ModelState.IsValid)
            {
                db.Questions.Add(question);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.partyID = new SelectList(db.Parties, "ID", "title", question.partyID);
            return View(question);
        }
コード例 #2
0
 public ActionResult Edit(Question question)
 {
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.partyID = new SelectList(db.Parties, "ID", "title", question.partyID);
     return View(question);
 }