private void buttonDel_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { logic.Delete(new PostBindingModel { Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value) }); LoadData(); } }