Example #1
0
 public IQueryable <Section> AllByUser(long userId, string[] roles)
 {
     if (roles.Contains("Admin"))
     {
         return(_sectionsRepository.GetAll());
     }
     else if (roles.Contains("Professor"))
     {
         return(_sectionsRepository.GetAllByProfessor(userId));
     }
     else if (roles.Contains("Student"))
     {
         return(_sectionsRepository.GetAllByStudent(userId));
     }
     throw new UnauthorizedException("No tiene permiso");
 }