/// <summary> /// Get SectionsViewModel of the specified school /// </summary> public async Task <SectionsViewModel> GetSectionsViewModelAsync(UserContext userContext, string objectId) { var school = await educationServiceClient.GetSchoolAsync(objectId); var mySections = await educationServiceClient.GetMyClassesAsync(school.ExternalId); //works for our tenant //var mySections = await educationServiceClient.GetMyClassesAsync(school.SchoolNumber); // Courses not currently represented. mySections = mySections.OrderBy(c => c.DisplayName).ToArray(); var allSections = await educationServiceClient.GetAllClassesAsync(school.Id, null); foreach (var section in allSections.Value) { foreach (var mySection in mySections) { if (section.Id == mySection.Id) { section.Teachers = mySection.Teachers; section.Members = mySection.Members; } } } return(new SectionsViewModel(userContext, school, allSections, mySections)); }
public async Task <SectionsViewModel> GetSectionsViewModelAsync(UserContext userContext, string objectId, bool mySections) { var school = await educationServiceClient.GetSchoolAsync(objectId); var sections = mySections ? await educationServiceClient.GetMySectionsAsync(school.SchoolId) : await educationServiceClient.GetAllSectionsAsync(school.SchoolId); return(new SectionsViewModel(userContext.UserO365Email, school, sections.OrderBy(c => c.CombinedCourseNumber))); }
/// <summary> /// Get SectionsViewModel of the specified school /// </summary> public async Task <SectionsViewModel> GetSectionsViewModelAsync(UserContext userContext, string objectId) { var school = await educationServiceClient.GetSchoolAsync(objectId); var mySections = await educationServiceClient.GetMyClassesAsync(school.SchoolNumber); // Courses not currently represented. mySections = mySections.OrderBy(c => c.DisplayName).ToArray(); var allSections = await educationServiceClient.GetAllClassesAsync(school.Id, null); return(new SectionsViewModel(userContext, school, allSections, mySections)); }
/// <summary> /// Get SectionsViewModel of the specified school /// </summary> public async Task <SectionsViewModel> GetSectionsViewModelAsync(UserContext userContext, string objectId, int top) { var school = await educationServiceClient.GetSchoolAsync(objectId); var mySections = await educationServiceClient.GetMySectionsAsync(school.SchoolNumber); mySections = mySections.OrderBy(c => c.CombinedCourseNumber).ToArray(); var allSections = await educationServiceClient.GetAllSectionsAsync(school.SchoolNumber, top, null); return(new SectionsViewModel(userContext, school, allSections, mySections)); }