private void editCoachButton_Click(object sender, RoutedEventArgs e) { Coach coach = new Coach(); int row = coachDataGrid.SelectedIndex; int id = Convert.ToInt32((coachDataGrid.Columns[0].GetCellContent(coachDataGrid.Items[row]) as TextBlock).Text); //MessageBox.Show(id.ToString()); try { using (var Db = new DatabaseContext()) { coach = Db.Coach.FirstOrDefault(c => c.id == id); } } catch (Exception ex) { MessageBox.Show(ex.Message); } addCoachWindow addCoachWindow = new addCoachWindow(coach); addCoachWindow.Show(); }
private void addCoachButton_Click(object sender, RoutedEventArgs e) { addCoachWindow addCoachWindow = new addCoachWindow(); addCoachWindow.Show(); }