public async Task <IActionResult> PutItem(long id, Item item) { if (id != item.Id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <Item> PutItem(long id, Item item) { if (id != item.Id) { } _context.Entry(item).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(id)) { } else { throw; } } return(item); }