예제 #1
0
 public static List <ApplicationUser> GetUserListInNowDisplayGroup()
 {
     using (var db = new ApplicationDbContext())
     {
         var nowDisplayRole = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole);
         var roleId         = db.Roles.Where(x => x.Name == nowDisplayRole).First().Id;
         return(db.Users.Where(x => x.Roles.Any(y => y.RoleId == roleId)).ToList());
     }
 }
예제 #2
0
        public static Lecture GetNowLecture()
        {
            var lectureId = HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowLecture);
            int id;

            if (!int.TryParse(lectureId, out id))
            {
                return(new Lecture());
            }
            var lecture = new Lecture();

            using (var db = new ApplicationDbContext())
            {
                lecture = db.Lectures.Where(x => x.Id == id).FirstOrDefault();
            }

            return(lecture);
        }
예제 #3
0
 public static string GetNowDisplayRole()
 {
     return(HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole));
 }