Ejemplo n.º 1
0
        private void Answer()
        {
            int choiceNumber = -1;

            if (IsChecked0)
            {
                choiceNumber = 0;
            }
            else if (IsChecked1)
            {
                choiceNumber = 1;
            }
            else if (IsChecked2)
            {
                choiceNumber = 2;
            }
            else if (IsChecked3)
            {
                choiceNumber = 3;
            }

            var command   = new QuizAnswerCommand(id, choiceNumber);
            var result    = quizApplicationService.Answer(command);
            var isCorrect = result.IsCorrect;

            if (isCorrect)
            {
                Correct = "Correct!!";
            }
            else
            {
                Correct = "Incorrect";
            }
        }
Ejemplo n.º 2
0
        public ActionResult Details(IFormCollection collection, string id, QuizAnswerRequestModel quizAnswerRequestModel)
        {
            var choiceNumber = quizAnswerRequestModel.ChoiceNumber;
            var command      = new QuizAnswerCommand(id, choiceNumber);
            var result       = quizApplicationService.Answer(command);
            var isCorrect    = result.IsCorrect;

            return(View("Answer", isCorrect));
        }