public GetResponseVM Get() { GetResponseVM vm = new GetResponseVM(); try { vm = convertToVM(_alunoService.getAll()); } catch (Exception ex) { vm.ErroMensagem = ex.Message; } return(vm); }
private GetResponseVM convertToVM(IQueryable <Aluno> alunos) { GetResponseVM vm = new GetResponseVM(); try { foreach (var aluno in alunos) { vm.Alunos.Add(new GetResponseAlunosVM { idAluno = aluno.NumSeqAluno, NomeAluno = aluno.NomAbreviado, CPF = aluno.CpfAluno, Ativo = aluno.DtAtCadastral > DateTime.Now.AddMonths(-6) }); } } catch (Exception ex) { throw ex; } return(vm); }