public JsonResult ConsultarTurmas()
        {
            try
            {
                List <TurmaConsultaViewModel> lista = new List <TurmaConsultaViewModel>();
                TurmaRepository turmaRep            = new TurmaRepository();

                foreach (Turma turma in turmaRep.FindAll())
                {
                    lista.Add(new TurmaConsultaViewModel()
                    {
                        IdTurma = turma.IdTurma,
                        Nome    = turma.Nome
                    });
                }

                return(Json(lista, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(e.Message, JsonRequestBehavior.AllowGet));
            }
        }
 public List <Turma> ConsultarTurmas()
 {
     return(repository.FindAll());
 }