コード例 #1
0
        void LoadData(Person person)
        {
            Person = person;
            if (person != null)
            {
                using (ApplicationContext _context = new ApplicationContext())
                {
                    Students = new ObservableCollection <Student>(
                        _context.Students.Where(x => x.Person.ID == person.ID)
                        .Include(x => x.Payments)
                        .Include(x => x.Returns)
                        .Include(x => x.Person.MedicalDocs)
                        .Include(x => x.Module.Group.Course));

                    SelectedStudent = Students.FirstOrDefault();

                    var parents = _context.PersonParents.Where(x => x.Person_ID == person.ID).Select(x => x.Parent).ToList();
                    ParentPicker = new ParentPickerVM(parents);
                }
            }
        }
コード例 #2
0
        void LoadData(Group selectedGroup = null)
        {
            ParentPicker = new ParentPickerVM();
            Parents      = new ObservableCollection <Parent>();
            Person       = new Person();
            AddNewMode   = true;
            using (var _context = new ApplicationContext())
            {
                Courses        = new ObservableCollection <Course>(_context.Courses.Include(x => x.Groups.Select(t => t.Modules)));
                Persons        = new ObservableCollection <Person>(_context.Persons.OrderBy(x => x.SecondName));
                SelectedPerson = Persons.FirstOrDefault();
            }

            if (selectedGroup != null)
            {
                SelectedGroup  = selectedGroup;
                SelectedCourse = selectedGroup.Course;
            }
            else
            {
                SelectedCourse = Courses.FirstOrDefault();
            }
        }