private void SaveChanges(object sender, EventArgs e) { if (authorsListBox.SelectedIndex == -1 || publishersListBox.SelectedIndex == -1 || genresListBox.SelectedIndex == -1) { MessageBox.Show("Pogreska pri unosu. Sva polja moraju imati sadrzaj!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var title = bookTitleTextBox.Text; var author = authorsListBox.SelectedItem.ToString(); var publisher = publishersListBox.SelectedItem.ToString(); var genre = genresListBox.SelectedItem.ToString(); var numberOfPages = numberOfPagesTextBox.Text; var totalBooks = totalBooksTextBox.Text; var isSaved = _booksRepository.AddOrEditBook(title, author, publisher, genre, numberOfPages, totalBooks, null); if (!isSaved) { MessageBox.Show("Pogreska pri unosu. Sva polja moraju imati sadrzaj!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Knjiga uspjesno spremljena!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } }