public IActionResult Get()
 {
     try
     {
         return(Ok(_perguntaRepository.Listar()));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
示例#2
0
        public IActionResult Listar()
        {
            try{
                var lista = _repo.Listar();

                if (lista.Count == 0)
                {
                    return(NotFound("Não foi encontrada nenhuma pergunta"));
                }

                return(Ok(lista));
            }
            catch (Exception e) {
                throw new Exception(e.Message);
            }
        }