public void DeleteContract(int id, string Curency, int Amount, int ClientId, int SalePeopleId, int AutoId) { Contract user = new Contract() { Id = id, Curency = Curency, Amount = Amount, ClientId = ClientId, SalePeopleId = SalePeopleId, AutoId = AutoId }; contractLogic.Delete(user); }
private void buttonDelete_Click(object sender, EventArgs e) { if (dataGridViewContracts.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = Convert.ToInt32(dataGridViewContracts.SelectedRows[0].Cells[0].Value); try { logic.Delete(new ContractBindingModel { Id = id }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadData(); } } }