public ActionResult Edit([Bind(Include = "ChoiceID,ChoiceText,QuestionID")] Choice choice) { if (ModelState.IsValid) { db.Entry(choice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.QuestionID = new SelectList(db.Questions, "QuestionID", "QuestionText", choice.QuestionID); return(View(choice)); }
public ActionResult Edit([Bind(Include = "QuizID,QuizName,Category,Author")] Quiz quiz) { quiz.Author = User.Identity.Name; if (ModelState.IsValid) { db.Entry(quiz).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(quiz)); }
public ActionResult Edit([Bind(Include = "AnswerID,AnswerText,QuestionID")] Answer answer) { if (ModelState.IsValid) { answer.QuestionID = question_id; db.Entry(answer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.QuestionID = new SelectList(db.Questions, "QuestionID", "QuestionText", answer.QuestionID); return(View(answer)); }