private PerguntaModel GetPergunta()
 {
     var pergunta = new PerguntaModel()
     {
         Descricao = Request.Form["descricaoPergunta"].ToString(),
         Dificuldade = Request.Form["dificuldade"].ToString().Equals("Basica") ? 1 : 2
     };
     pergunta.PossiveisRespostas = GetResposta();
     return pergunta;
 }
示例#2
0
        public ViewResult Responde(PerguntaModel pergunta)
        {
            RespostaModel respostaProposta = new RespostaModel() { RespostaId = Convert.ToInt32(Request.Form[0]) };
            bool isCorreta = _quizAplicacao.IsCorreta(this.Quiz, new UsuarioModel() { UsuarioId = 1 }, this.Pergunta, respostaProposta);

            string mensagem = string.Empty;
            if (isCorreta)
                mensagem = "Yes! =]";
            else
                mensagem = "Não, não! Não foi desta vez!";

            var novaPergunta  = this.Next(this.Pergunta.PerguntaId + 1);
            if (novaPergunta != null)
            {
                this.Pergunta = novaPergunta;
                return View("Pergunta", this.Pergunta);
            }
            else
                return View("Game over!");
        }
示例#3
0
 public bool IsCorreta(QuizModel quiz, UsuarioModel usuario, PerguntaModel pergunta, RespostaModel resposta)
 {
     return CorrigeResposta(quiz.QuizId, usuario.UsuarioId, pergunta.PerguntaId, resposta.RespostaId);
 }