private void NewButton_Click(object sender, RoutedEventArgs e) { var detailWindow = new EmployeeDetailWindow(); if (detailWindow.ShowDialog() != true) { return; } _ctx.Employees.Add(detailWindow.Model); _ctx.SaveChanges(); LoadEmployees(); }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { if (MainGrid.SelectedItem == null) { return; } var detailWindow = new EmployeeDetailWindow(MainGrid.SelectedItem as Employee); if (detailWindow.ShowDialog() != true) { return; } _ctx.SaveChanges(); LoadEmployees(); }