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()); } }
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); }
public static string GetNowDisplayRole() { return(HogwartsSettingUtility.GetSetting(HogwartsSettingUtility.NowDisplayRole)); }