public static void ValidateLecturerAccess(IDpContext context, int userId)
 {
     if (!IsLecturer(context, userId))
     {
         throw new ApplicationException("Only lecturers have permissions for this operation!");
     }
 }
Beispiel #2
0
 public static void ValidateLecturerAccess(IDpContext context, int userId)
 {
     if (!IsLecturer(context, userId))
     {
         throw new ApplicationException("Only lecturers have permissions for this operation!");
     }
 }
 public static bool IsGraduateStudent(IDpContext context, int userId)
 {
     return context.Users.Where(x => x.Id == userId).Select(x => x.Student).Any(context.StudentIsGraduate);
 }
 public static bool IsStudent(IDpContext context, int userId)
 {
     return context.Users.Include(x => x.Student).Single(x => x.Id == userId).Student != null;
 }
 public static bool IsLecturer(IDpContext context, int userId)
 {
     return context.Users.Include(x => x.Lecturer).Single(x => x.Id == userId).Lecturer != null;
 }
Beispiel #6
0
 public static bool IsGraduateStudent(IDpContext context, int userId)
 {
     return(context.Users.Where(x => x.Id == userId).Select(x => x.Student).Any(context.StudentIsGraduate));
 }
Beispiel #7
0
 public static bool IsStudent(IDpContext context, int userId)
 {
     return(context.Users.Include(x => x.Student).Single(x => x.Id == userId).Student != null);
 }
Beispiel #8
0
 public static bool IsLecturer(IDpContext context, int userId)
 {
     return(context.Users.Include(x => x.Lecturer).Single(x => x.Id == userId).Lecturer != null);
 }