Exemplo n.º 1
0
 public ActionResult Edit(Question question)
 {
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AnswerId = new SelectList(db.Answers, "AnswerId", "AnswerText", question.AnswerId);
     return View(question);
 }
Exemplo n.º 2
0
        public ActionResult Create(Question question)
        {
            if (ModelState.IsValid)
            {
                db.Questions.Add(question);
                db.SaveChanges();
                return RedirectToAction("Index");  
            }

            ViewBag.AnswerId = new SelectList(db.Answers, "AnswerId", "AnswerText", question.AnswerId);
            return View(question);
        }