public ActionResult QuestionAndAnswer(QuestionAndAnswerModel model) { if(ModelState.IsValid) { if(MembershipService.ChangeQuestionAndAnswer(_currentUser.UserName, model.Password, model.Question, model.Answer)) return View("QuestionAndAnswerSuccess"); ModelState.AddModelError("Password", "Incorrect password provided. Please try again."); } model.Questions = new SelectList(QuestionSelectListItems, "Text", "Value"); return View(model); }
public ActionResult QuestionAndAnswer() { var questions = QuestionSelectListItems; var model = new QuestionAndAnswerModel() { Questions = new SelectList(questions, "Text", "Value") }; return View(model); }