public async Task <IActionResult> PutItem(int 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 <IActionResult> PutGroceryList(int id, GroceryList groceryList) { if (id != groceryList.Id) { return(BadRequest()); } _context.Entry(groceryList).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroceryListExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }