private void GetTeachersFromService() { DynamicCollection = new ObservableCollection<Faculty>(); FacultiesList facultiesList; using (var service = new UnivercityServiceClient()) { facultiesList = service.GetFacultiesList(); } foreach (var faculty in facultiesList.Faculties) { DynamicCollection.Add(faculty); } }
private void GetTeachersFromService() { DynamicCollection = new ObservableCollection<Course>(); CoursesList coursesList; using (var service = new UnivercityServiceClient()) { coursesList = service.GetCoursesList(); } foreach (var course in coursesList.Courses) { DynamicCollection.Add(course); } }
private void GetTeachersFromService() { DynamicCollection = new ObservableCollection<Teacher>(); TeachersList teachersList; using (var service = new UnivercityServiceClient()) { teachersList = service.GetTeachersList(); } foreach (var teacher in teachersList.Teachers) { DynamicCollection.Add(teacher); } }
private void GetSectionsFromService() { DynamicCollection = new ObservableCollection<Section>(); SectionsList sectionsList; using (var service = new UnivercityServiceClient()) { sectionsList = service.GetSectionsList(); } foreach (var sec in sectionsList.Sections) { DynamicCollection.Add(sec); } }
// ici on reçoi un message de la StudentPage avec les données des champs // à modifier // et c'est ici qu'on va appeler le service private void ModifyStudent_FromView(StudentStateMessage std) { Messenger.Default.Send(new ProgressRingMessage(true)); using (var service = new UnivercityServiceClient()) { Student modifiedStudent = new Student() { Id = std.StudentId, Name = std.Name, Surname = std.Surname, Age = std.Age, Sex = std.Sex, CurrentClass = std.CurrentClass, EnrollmentDate = std.EnrollmentDate.Value }; bool ok = service.ModifyStudent(modifiedStudent); if (ok) { var item = DynamicCollection.FirstOrDefault(s => s.Id == std.StudentId); if (item != null) item = modifiedStudent; } else { NewStudentErrorMessage = "Something went wrong :("; } } Messenger.Default.Send(new ProgressRingMessage(false)); }
private void GetStudentsFromService() { StudentsList studentsList; using (var service = new UnivercityServiceClient()) { studentsList = service.GetStudentsList(); } foreach (var std in studentsList.Students) { DynamicCollection.Add(std); } }
private void DeleteStudent(Student std) { if (std != null) { using (var service = new UnivercityServiceClient()) { service.DeleteStudent(std.Id); } DynamicCollection.Remove(std); } }
private void AddStudent() { Messenger.Default.Send(new ProgressRingMessage(true)); _newStudentErrorMessage = ""; if (ValidData()) { Student newStd = new Student() { Name = NewStudent.Name, Surname = NewStudent.Surname, Age = NewStudent.Age, Sex = NewSexEnum, EnrollmentDate = NewStudent.EnrollmentDate, CurrentClass = NewStudent.CurrentClass }; using (var service = new UnivercityServiceClient()) { int id = service.AddStudent(newStd); if (id > 0) { newStd.Id = id; DynamicCollection.Add(newStd); ClearNewStudent(); } } } else { NewStudentErrorMessage = "Wrong Data !!!"; } Messenger.Default.Send(new ProgressRingMessage(false)); }