示例#1
0
        public void Excluir(Aluno aluno)
        {
            try
            {
                if (aluno.ID == 0)
                {
                    throw new AlunoNaoExcluidoExcecao();
                }

                List <Aluno> resultado = alunoRepositorio.Consultar(aluno, TipoPesquisa.E);

                if (resultado == null || resultado.Count <= 0 || resultado.Count > 1)
                {
                    throw new AlunoNaoExcluidoExcecao();
                }

                resultado[0].Status = (int)Status.Inativo;
                this.Alterar(resultado[0]);
            }
            catch (Exception e)
            {
                throw e;
            }
            //this.alunoRepositorio.Excluir(aluno);
        }
示例#2
0
        public IActionResult Index()
        {
            var aluno = _alunoRepositorio.Consultar();

            if (aluno.Any())
            {
                var alunoDto = aluno.Select(x => new AlunoParaListagemDto
                {
                    Cpf   = x.Cpf,
                    Email = x.Email,
                    Id    = x.Id,
                    Nome  = x.Nome
                });
                return(View("Index", PaginatedList <AlunoParaListagemDto> .Create(alunoDto, Request)));
            }
            return(View("Index", PaginatedList <AlunoParaListagemDto> .Create(null, Request)));
        }