コード例 #1
0
ファイル: HomeController.cs プロジェクト: Ani1313/Eco
        public ActionResult NewQuestion(int? questionId, int? answerIndex, int? slidebarValue)
        {
            if (questionId == null)
            {
                return HttpNotFound();
            }
            Question question = db.Questions.Find(questionId);
            if (question == null)
                return HttpNotFound();


            if (question.Type == QuestionType.SlideBar)
                EcoCalculator.Calculate(question, (int)slidebarValue);
            else
                EcoCalculator.Calculate(question, question.Answers[(int)answerIndex]);


            Question nextQuestion = question.Type == QuestionType.Branching ?
                question.Answers[(int)answerIndex].NextQuestion :
                question.NextQuestion;
            if (nextQuestion == null)
                return RedirectToAction("EndResults");

            return RedirectToAction("Index", new { questionId = nextQuestion.ID });
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: Ani1313/Eco
 public ActionResult EndResults()
 {
     return View(EcoCalculator.GetFinalResults());
 }