public async System.Threading.Tasks.Task <IActionResult> RelatorioProfessor(int id) { var report = new List <RelatorioFinalObjectDTO>(); var perguntas = _PerguntaService.PerguntasByQuizzId(id).Select(x => x.PerguntaId); var alunos = (from A in _respostaService.GetAll() join B in _estudanteService.GetAll() on A.EstudanteId equals B.EstudanteId where perguntas.Contains(A.PerguntaId) select B).Distinct(); foreach (var item in alunos) { var result = _respostaService.GerarDadosRelatorio(id, item.EstudanteId, item.Nome); report.Add(result); } using (var client = new HttpClient()) { var teste = await client.PostAsJsonAsync("http://localhost:62626/Professor/RelatorioProfessor", report); var r = new FileContentResult(await teste.Content.ReadAsByteArrayAsync(), teste.Content.Headers.ContentType.MediaType); return(r); } }
public IEnumerable <RespostaViewModel> GetAll() { return(Mapper.Map <IEnumerable <Resposta>, IEnumerable <RespostaViewModel> >(_respostaService.GetAll())); }