Exemplo n.º 1
0
 public void Add(PerguntaDTO pergunta)
 {
     if (pergunta != null)
     {
         var config = new MapperConfiguration(cfg => {
             cfg.CreateMap <PerguntaDTO, Pergunta>();
         });
         IMapper iMapper     = config.CreateMapper();
         var     destination = iMapper.Map <PerguntaDTO, Pergunta>(pergunta);
         var     quizz       = _quizzService.GeyById(pergunta.QuizzId);
         if (quizz != null)
         {
             perguntaRepository.Add(destination);
             quizz.Pergunta.Add(destination);
             _quizzRepository.Update(quizz);
         }
     }
 }
Exemplo n.º 2
0
        public IActionResult IniciarQuizz(int id)
        {
            var sessaoNome = User.Identity.Name;
            var sessao     = _userManager.FindByNameAsync(sessaoNome).Result.Id;
            var aluno      = _alunoService.GetbySession(sessao);
            var nomeQuizz  = _serviceQuizz.GeyById(id);
            var respostas  = _respostaService.ObterPorAlunoId(id, aluno.EstudanteId);

            if (respostas.Count == 10)
            {
                return(RedirectToAction("RelatorioFinal", "Aluno", new { QuizzId = nomeQuizz.QuizzId, alunoId = aluno.EstudanteId, sessaoNome = sessaoNome }));
            }
            else
            {
                var perguntas = _serviceQuizz.buscarPerguntaParaIniciarQuizz(id, aluno.EstudanteId);
                return(View(perguntas));
            }
        }
Exemplo n.º 3
0
        public IActionResult Create(int id)
        {
            var niveis    = _nivelService.buscarNiveis();
            var quizz     = _quizzService.GeyById(id);
            var perguntas = _quizzService.buscarPerguntas(id);

            quizz.Pergunta = perguntas;
            if (quizz.Pergunta.Count() < 10)
            {
                var pergunta = new PerguntaDTO();
                pergunta.Quizz   = quizz;
                pergunta.QuizzId = quizz.QuizzId;
                foreach (var item in niveis)
                {
                    pergunta.niveis.Add(item);
                }
                return(View(pergunta));
            }

            return(RedirectToAction("Voltar", "Professor"));
        }
Exemplo n.º 4
0
        public IActionResult Edit(int id)
        {
            var quizz = _service.GeyById(id);

            return(View(quizz));
        }