public IActionResult DeleteItem(int id) { try { var cm = new ItemManagement(); var item = new Item() { id = id }; cm.DeleteItem(item); return(Ok()); } catch (Exception ex) { return(StatusCode(500, ex)); } }
private void deleteButton_Click(object sender, EventArgs e) { //Set Id as Mandatory if (String.IsNullOrEmpty(idtextBox.Text)) { MessageBox.Show("Id Can not be Empty!!!"); return; } //Delete if (_itemManagement.DeleteItem(Convert.ToInt32(idtextBox.Text))) { MessageBox.Show("Deleted"); } else { MessageBox.Show("Not Deleted"); } //showDataGridView.DataSource = dataTable; showDataGridView.DataSource = _itemManagement.ShowItemInfo(); }