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, 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)); }