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