private void InitCoursesList() { List <CourseModel> currentCourses = new List <CourseModel>(); using (var client = HttpHelpers.InitializeHttpClient()) { HttpResponseMessage response = client.GetAsync("api/course").Result; if (HttpHelpers.IsSuccessfullRequest(response, "Váratlan hiba történt, a kuzusok lekérdezése nem sikerült. Kérjük, próbálja később!")) { currentCourses = response.Content.ReadAsAsync <IEnumerable <CourseModel> >().Result.ToList(); } } int selectedCourseId = 0; if (SelectedCourse != null) { selectedCourseId = SelectedCourse.CourseID; } CourseList = currentCourses; if (selectedCourseId != 0) { SelectedCourse = CourseList.First(c => c.CourseID == selectedCourseId); } }
protected override void LoadInitalData() { db.Courses.Where(c => c.External == false && c.Obselete == false).OrderBy(c => c.CourseName).Load(); CourseList = db.Courses.Local.Where(c => c.External == false && c.Obselete == false).OrderBy(c => c.CourseName).ToList(); SelectedCourse = CourseList.First(); ResetSearch(null); }
private void Search(object parameter) { CourseList = db.search_course(SearchName, SearchParis, SearchChildHealth, SearchExternal, SearchObselete).OrderBy(c => c.CourseName).ToList(); SelectedCourse = CourseList.First(); }