/// <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));
        }
Ejemplo n.º 2
0
        /// <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));
        }