Exemple #1
0
        public GetResponseVM Get()
        {
            GetResponseVM vm = new GetResponseVM();

            try
            {
                vm = convertToVM(_alunoService.getAll());
            }
            catch (Exception ex)
            {
                vm.ErroMensagem = ex.Message;
            }

            return(vm);
        }
Exemple #2
0
        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);
        }