public IActionResult UpdateItem(Item c) { try { var cm = new ItemManagement(); cm.UpdateItem(c); return(Ok()); } catch (Exception ex) { return(StatusCode(500, ex)); } }
private void updateButton_Click(object sender, EventArgs e) { //Set Id as Mandatory if (String.IsNullOrEmpty(idtextBox.Text)) { MessageBox.Show("Id Can not be Empty!!!"); return; } //Set Price as Mandatory if (String.IsNullOrEmpty(priceTextBox.Text)) { MessageBox.Show("Price Can not be Empty!!!"); return; } if (_itemManagement.UpdateItem(itemTextBox.Text, Convert.ToInt32(priceTextBox.Text), Convert.ToInt32(idtextBox.Text))) { MessageBox.Show("Updated"); _itemManagement.ShowItemInfo(); } //showDataGridView.DataSource = dataTable; showDataGridView.DataSource = _itemManagement.ShowItemInfo(); }