public async Task InitCourses() { TotalStudents = await courseService.GetTotalStudentsFromInstructorsCourses <int>(User.UserID); TotalCourses = await courseService.GetTotalInstructorsCourses <int>(User.UserID); TotalRating = await courseService.GetAverageInstructorsCoursesRating <float>(User.UserID); try { CourseSearchRequest request = new CourseSearchRequest() { UserID = User.UserID }; InstructorList.Clear(); var courses = await courseService.Get <List <MCourse> >(request); foreach (var course in courses) { if (courses.Count > 0) { InstructorList.Add(new CourseVM(course)); } } } catch (Exception) { } }
public async Task InitLectures() { Rating = await courseService.GetAverageRating <float>(Course.CourseID); Total = await courseService.GetTotalStudents <int>(Course.CourseID); videoLectureList.Clear(); try { var lectures = await courseService.GetLectures <List <MVideoLecture> >(Course.CourseID, null); if (lectures.Count() != 0) { foreach (var lecture in lectures) { videoLectureList.Add(lecture); var req = new SectionSearchRequest { SectionID = lecture.SectionID }; var sections = await sectionService.Get <List <MSection> >(req); foreach (var section in sections) { if (lecture.SectionID == section.SectionID) { sectionList.Add(section); } } } foreach (var x in sectionList) { var DoesItContain = NewsectionList.Where(m => m.SectionID == x.SectionID).Any(); if (DoesItContain == false) { NewsectionList.Add(x); } } } CourseSearchRequest request = new CourseSearchRequest() { UserID = Course.User.UserID }; InstructorList.Clear(); var courses = await courseService.Get <List <MCourse> >(request); foreach (var course in courses) { if (courses.Count > 0) { if (course.CourseID != Course.CourseID) { InstructorList.Add(new CourseVM(course)); } } else { InstructorList.Add(new CourseVM(course)); } } } catch (Exception) { } }