Example #1
0
        public async Task <IActionResult> Index()
        {
            if (HttpContext.User.Claims.Any(c => c.Value == TipoUsuario.Aluno.ToString()))
            {
                var user = await _userManager.GetUserAsync(HttpContext.User);

                var disciplina = _disciplinaRepository.GetAll().Where(c => c.CursoId == user.CursoId);
                var turmas     = _turmaRepository.GetAll().Where(c => disciplina.Any(d => c.DisciplinaId == d.DisciplinaId)).Include(c => c.Professor);
                return(View(turmas));
            }
            return(View(_turmaRepository.GetAll().Include(c => c.Professor).ToList()));
        }
 public IEnumerable <Disciplina> GetAll()
 {
     return(_disciplinaRepository.GetAll());
 }
        // GET: Disciplina
        public async Task <IActionResult> Index()
        {
            var applicationDbContext = _disciplinaRepository.GetAll().Include(c => c.Curso);

            return(View(await applicationDbContext.ToListAsync()));
        }