public async Task Init() { videoLectureList.Clear(); try { VideoLectureSearchRequest reqq = new VideoLectureSearchRequest(); if (SelectedSection != null) { reqq = new VideoLectureSearchRequest { SectionID = SelectedSection.SectionID }; } var lectures = await courseService.GetLectures <List <MVideoLecture> >(Course.CourseID, reqq); 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); } } } catch { } }
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) { } }