public async Task <IActionResult> DeleteField(int id) { var delete = await _fieldLogic.Delete(id); if (delete) { return(NoContent()); } return(NotFound()); }
private void buttonDelete_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); try { logic.Delete(new FieldBindingModel { Id = id }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadData(); } } }