public static List <SchoolYear> GetSchoolYears(int schoolId) { try { return(SchoolEntity.GetSchool(schoolId).SchoolYears.ToList()); } catch (Exception ex) { throw ex; } }
public static List <Club> GetClubs(int schoolId) { try { using (SmacEntities context = new SmacEntities()) { return(SchoolEntity.GetSchool(schoolId).Clubs.ToList()); } } catch (Exception ex) { throw ex; } }
public static List <Class> GetAllClassesInSchool(int schoolId) { try { using (SmacEntities context = new SmacEntities()) { var sch = SchoolEntity.GetSchool(schoolId); if (sch != null) { List <Class> classList = new List <Class>(); sch.Subjects.ToList().ForEach(t => t.Classes.ToList().ForEach(m => classList.Add(m))); return(classList); } else { throw new Exception("School name not found. Aborting."); } } } catch (Exception ex) { throw ex; } }
public static List <Section> GetAllSchoolSections(int schoolId) { try { using (SmacEntities context = new SmacEntities()) { var sch = SchoolEntity.GetSchool(schoolId); if (sch != null) { List <Section> sections = new List <Section>(); sch.Subjects.ToList().ForEach(t => t.Classes.ToList().ForEach(m => m.Sections.ToList().ForEach(g => sections.Add(g)))); return(sections); } else { throw new Exception("School does not exist. Aborting."); } } } catch (Exception ex) { throw ex; } }