private void PublisherEditButtonClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(publisherNameTextBox.Text)) { var errorForm = new ErrorForm("You need to fill al boxes"); errorForm.ShowDialog(); } else { var publisherToEdit = new Publisher { Name = publisherNameTextBox.Text, PublisherId = SelectedPublisher.PublisherId, Books = SelectedPublisher.Books }; PublisherRepository.EditPublisher(publisherToEdit); Close(); } }