Exemple #1
0
        private void AddStudentHandler(object sender, Structures.Student nStudent)
        {
            var source = DataGrid.ItemsSource as ObservableCollection <Structures.Student>;

            source.Add(nStudent);
            DAL.StudentDBService.AddToDB(nStudent);
        }
Exemple #2
0
        private void UpdateStudentHandler(object sender, Structures.Student uStudent)
        {
            var source   = DataGrid.ItemsSource as ObservableCollection <Structures.Student>;
            var index    = source.ToList().FindIndex(s => s.id == uStudent.id);
            var toUpdate = source[index];

            toUpdate.FirstName   = uStudent.FirstName;
            toUpdate.LastName    = uStudent.LastName;
            toUpdate.IndexNumber = uStudent.IndexNumber;
            DataGrid.Items.Refresh();
            DAL.StudentDBService.UpdateDB(uStudent);
        }