private void EditButton_Click(object sender, RoutedEventArgs e) { LecturerGridModel lecturer = (LecturerGridModel)LecturerDataGrid.SelectedItem; _ = this.LoadDataForEditAsync(lecturer.EmployeeId); LecturerTabControl.SelectedIndex = 1; }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { LecturerGridModel lecturer = (LecturerGridModel)LecturerDataGrid.SelectedItem; LecturerDataService lecturerDataService = new LecturerDataService(new EntityFramework.TimetableManagerDbContext()); lecturerDataService.DeleteLecturer(lecturer.EmployeeId).ContinueWith(result => { if (result == null) { MessageBox.Show("Sorry! Error occured", "Error"); } }); _ = LecturerDataList.Remove(lecturer); }
private async Task LoadLecturerData() { LecturerDataService lecturerDataService = new LecturerDataService(new EntityFramework.TimetableManagerDbContext()); LecturerList = await lecturerDataService.GetLecturersAsync(); LecturerList.ForEach(e => { LecturerGridModel lecturerObj = new LecturerGridModel { EmployeeId = e.EmployeeId, EmployeeName = e.EmployeeName, FacultyName = e.Faculty.FacultyName, DepartmentName = e.Department.DepartmentName, CenterName = e.Center.CenterName, BuildingName = e.Building.BuildingName, LevelName = e.Level.LevelName, Rank = e.Rank }; LecturerDataList.Add(lecturerObj); }); }