public IHttpActionResult PutItem(int id, Models.Item item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != item.Ino) { return(BadRequest()); } db.Entry(item).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void toolBar_btnNew_Click(object sender) { try { app_branch app_branch = app_branchViewSource.View.CurrentItem as app_branch; item_inventory item_inventory = new item_inventory(); item_inventory.IsSelected = true; item_inventory.id_branch = app_branch.id_branch; item_inventory.trans_date = DateTime.Now; InventoryDB.Entry(item_inventory).State = EntityState.Added; item_inventory.State = EntityState.Added; app_branchViewSource.View.MoveCurrentToFirst(); app_branchapp_locationViewSource.View.MoveCurrentToFirst(); item_inventoryViewSource.View.Refresh(); item_inventoryViewSource.View.MoveCurrentToLast(); } catch (Exception ex) { toolBar.msgError(ex); } }