public async Task <ActionResult <TurmaViewModel> > ObterPorId(int id) { TurmaViewModel model; try { var turma = await _turmaService.BuscarPorID(id); if (turma == null) { return(NotFound()); } model = _mapper.Map <TurmaViewModel>(turma); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok(model)); }