Ejemplo n.º 1
0
 public ActionResult <IEnumerable <Turma> > GetTurma()
 {
     try
     {
         return(_turmaRepository.GetAllTurmas());
     }
     catch (Exception ex)
     {
         return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Ops! Houve um erro: { ex.Message }."));
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var turma = await _repo.GetAllTurmas();

                if (turma.Length == 0)
                {
                    return(NotFound(MSG.NaoExisteTurma));
                }
                return(Ok(turma));
            }
            catch (Exception)
            {
                return(this.StatusCode(StatusCodes.Status501NotImplemented, MSG.BancoDadosFalhou));
            }
        }