Exemplo n.º 1
0
        public ICollection <Pergunta> buscarPerguntas(int id)
        {
            var perguntas = repoPergunta.GetAll().Result;

            perguntas = perguntas.Where(x => x.QuizzId == id).ToList();

            return(perguntas);
        }
Exemplo n.º 2
0
        public RelatorioFinalObjectDTO GerarDadosRelatorio(int quizzId, int alunoId, string sessaoNome)
        {
            var perguntas = (from A in _repositoryQuizz.GetAll().Result
                             join B in _repositoryPergunta.GetAll().Result
                             on A.QuizzId equals B.QuizzId
                             where A.QuizzId == quizzId
                             select B
                             ).Distinct().ToList();

            var respostas = (from B in perguntas
                             join C in _repositoyResposta.GetAll().Result
                             on B.PerguntaId equals C.PerguntaId
                             join D in _repositoryEstudanteResposta.GetAll().Result
                             on C.RespostaId equals D.RespostaId
                             join E in _repositoryEstudante.GetAll().Result
                             on D.EstudanteId equals E.EstudanteId
                             where C.EstudanteId == alunoId && B.QuizzId == quizzId
                             select C).Distinct().ToList();

            var nomeAluno = (from B in perguntas
                             join C in _repositoyResposta.GetAll().Result
                             on B.PerguntaId equals C.PerguntaId
                             join D in _repositoryEstudanteResposta.GetAll().Result
                             on C.RespostaId equals D.RespostaId
                             join E in _repositoryEstudante.GetAll().Result
                             on D.EstudanteId equals E.EstudanteId
                             select E.Nome).Distinct().FirstOrDefault();

            var nomeQuizz = (from A in _repositoryQuizz.GetAll().Result
                             join B in _repositoryPergunta.GetAll().Result
                             on A.QuizzId equals B.QuizzId
                             where A.QuizzId == quizzId
                             select A.Descricao
                             ).Distinct().FirstOrDefault();

            var retorno = new RelatorioFinalObjectDTO
            {
                Perguntas = _mapper.Map <List <PerguntaDTO> >(perguntas),
                Resposta  = _mapper.Map <List <RespostaDTO> >(respostas),
                NomeAluno = nomeAluno,
                NomeQuizz = nomeQuizz
            };

            return(retorno);
        }
Exemplo n.º 3
0
        public List <Pergunta> GetPerguntas()
        {
            /*banco de dados*/

            var perguntas = _repo.GetAll().Result;

            return(perguntas.ToList());

            ///*Teste Unitários*/
            //var perguntas = MockListaPergunta();

            //return perguntas;
        }
Exemplo n.º 4
0
        public List <Pergunta> PerguntasByQuizzId(int id)
        {
            var perguntas = perguntaRepository.GetAll().Result.Where(x => x.QuizzId == id).ToList();

            return(perguntas);
        }