コード例 #1
0
        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);
        }
コード例 #2
0
        public ActionResult QuestionAndAnswer()
        {
            var questions = QuestionSelectListItems;

            var model = new QuestionAndAnswerModel() {
                                                         Questions = new SelectList(questions, "Text", "Value")
                                                     };

            return View(model);
        }