Exemplo n.º 1
0
 public IActionResult Listar()
 {
     try
     {
         return(Ok(_alunoRepositorio.Listar()));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { sucesso = false, mensagem = ex.Message }));
     }
 }
Exemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <Aluno> > > Get()
        {
            var alunos = await _repositorio.Listar();

            if (alunos == null)
            {
                return(NoContent());
            }

            _Logger.Info(alunos);
            var map = _mapper.Map <IEnumerable <Aluno> >(alunos);

            return(Ok(new OkResponse(map)));
        }
        public IQueryResult Handle(ListarAlunoQuery command)
        {
            var query = _alunoRepositorio.Listar();

            var alunos = query.Select(
                x =>
            {
                return(new ListarQueryResult()
                {
                    Id = x.Id,
                    NomeUsuario = x.NomeUsuario,
                    Email = x.Email,
                    Telefone = x.Telefone,
                    Rg = x.Rg,
                    Cpf = x.Cpf,
                });
            }

                );

            return(new GenericQueryResult(true, "Alunos", alunos));
        }
Exemplo n.º 4
0
 // GET: Aluno
 public ActionResult Index()
 {
     return(View(_rep.Listar()));
 }