private void edit_Button_Click(object sender, EventArgs e) { TeamEditor editor = new TeamEditor(); editor.name_textBox.Text = team.Name; editor.couch_TextBox.Text = team.Couch; DialogResult result = editor.ShowDialog(this); if (result == DialogResult.Cancel) { return; } team.Name = editor.name_textBox.Text; team.Couch = editor.couch_TextBox.Text; context.SaveChanges(); teams_DataGridView.Refresh(); }
private void add_Button_Click(object sender, EventArgs e) { TeamEditor editor = new TeamEditor(); DialogResult result = editor.ShowDialog(this); if (result == DialogResult.Cancel) { return; } context.Teams.Add ( new Team { Name = editor.name_textBox.Text, Couch = editor.couch_TextBox.Text == string.Empty ? null : editor.couch_TextBox.Text } ); context.SaveChanges(); teams_DataGridView.Refresh(); }