public ActionResult <IEnumerable <Turma> > GetTurma() { try { return(_turmaRepository.GetAllTurmas()); } catch (Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Ops! Houve um erro: { ex.Message }.")); } }
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)); } }