private void ButtonAddStreetClick(object sender, EventArgs e) { AddForm addForm = new AddForm(); DialogResult result = addForm.ShowDialog(this); if (result == DialogResult.Cancel) { return; } if (addForm.textBoxName.Text.Count() < 1) { MessageBox.Show("Вы не ввели название"); return; } Street street = new Street { Name = addForm.textBoxName.Text, CityId = new Guid(dataGridViewCities.SelectedRows[0].Cells[0].Value.ToString()) }; streetDataService.Add(street); LoadDataGridViewStreets(); }
private void ButtonAddCountryClick(object sender, EventArgs e) { AddForm addForm = new AddForm(); DialogResult result = addForm.ShowDialog(this); if (result == DialogResult.Cancel) { return; } if (addForm.textBoxName.Text.Count() < 1) { MessageBox.Show("Вы не ввели название"); return; } Coutry coutry = new Coutry { Name = addForm.textBoxName.Text }; countryDataService.Add(coutry); LoadDataGridViewCountries(); }