private void btnSave_Click(object sender, EventArgs e) { //editare if (Edit) { try { objectBook.EditBooks(txtISBN.Text, txtDate.Text, txtTitle.Text, txtBookPublishing.Text); MessageBox.Show("The data was edited correctly"); ShowBooksfromModel(); ClearForm(); Edit = false; } catch (Exception ex) { MessageBox.Show("Data was not edited because" + ex); } } //inserare else { try { objectBook.InsertBooks(txtISBN.Text, txtDate.Text, txtTitle.Text, txtBookPublishing.Text); MessageBox.Show("The data was inserted correctly"); ShowBooksfromModel(); ClearForm(); } catch (Exception ex) { MessageBox.Show("Data was not inserted because" + ex); } } }