Exemplo n.º 1
0
 public static void ValidateLecturerAccess(IDpContext context, int userId)
 {
     if (!IsLecturer(context, userId))
     {
         throw new ApplicationException("Only lecturers have permissions for this operation!");
     }
 }
Exemplo n.º 2
0
 public static void ValidateLecturerAccess(IDpContext context, int userId)
 {
     if (!IsLecturer(context, userId))
     {
         throw new ApplicationException("Only lecturers have permissions for this operation!");
     }
 }
Exemplo n.º 3
0
 public static bool IsGraduateStudent(IDpContext context, int userId)
 {
     return context.Users.Where(x => x.Id == userId).Select(x => x.Student).Any(context.StudentIsGraduate);
 }
Exemplo n.º 4
0
 public static bool IsStudent(IDpContext context, int userId)
 {
     return context.Users.Include(x => x.Student).Single(x => x.Id == userId).Student != null;
 }
Exemplo n.º 5
0
 public static bool IsLecturer(IDpContext context, int userId)
 {
     return context.Users.Include(x => x.Lecturer).Single(x => x.Id == userId).Lecturer != null;
 }
Exemplo n.º 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));
 }
Exemplo n.º 7
0
 public static bool IsStudent(IDpContext context, int userId)
 {
     return(context.Users.Include(x => x.Student).Single(x => x.Id == userId).Student != null);
 }
Exemplo n.º 8
0
 public static bool IsLecturer(IDpContext context, int userId)
 {
     return(context.Users.Include(x => x.Lecturer).Single(x => x.Id == userId).Lecturer != null);
 }