public IActionResult Listar() { try { return(Ok(_alunoRepositorio.Listar())); } catch (Exception ex) { return(BadRequest(new { sucesso = false, mensagem = ex.Message })); } }
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)); }
// GET: Aluno public ActionResult Index() { return(View(_rep.Listar())); }