private void addButton_Click(object sender, EventArgs e) { using (var f = new EditAdditionalServiceForm()) { f.Saved += (s, eventArgs) => { additionalServices.Add(f.AdditionalService); f.Close(); }; f.ShowDialog(); } }
private void additionalServicesGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { var currentRow = additionalServicesGridView.CurrentRow; if (currentRow == null) { return; } var additionalService = additionalServices[currentRow.Index]; using (var f = new EditAdditionalServiceForm(additionalService.Id)) { f.Saved += (s, eventArgs) => { additionalService.Update(f.AdditionalService); f.Close(); }; f.ShowDialog(); } }