public ActionResult Edit(AnswerChoice answerchoice) { if (ModelState.IsValid) { db.Entry(answerchoice).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "QuestionText", answerchoice.QuestionId); return View(answerchoice); }
public ActionResult Create(AnswerChoice answerchoice) { if (ModelState.IsValid) { db.AnswerChoices.Add(answerchoice); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.QuestionId = new SelectList(db.Questions, "QuestionId", "QuestionText", answerchoice.QuestionId); return View(answerchoice); }