private void AddGroupButtonClick(object sender, EventArgs e) { using (var form = new GroupForm(this.groupsBindingSource.DataSource as List <Group>)) { DialogResult ok = form.ShowDialog(this); if (ok == DialogResult.OK) { this.db.SaveGroup(form.Group); this.LoadGroups(); } } }
private void EditGroup() { var group = this.groupsBindingSource.Current as Group; using (var form = new GroupForm(@group, this.groupsBindingSource.DataSource as List <Group>)) { DialogResult ok = form.ShowDialog(this); if (ok == DialogResult.OK) { this.db.UpdateGroup(form.Group); this.LoadGroups(); } } }