public async Task <IActionResult> PutShoppingList(int id, ShoppingList shoppingList) { if (id != shoppingList.Id) { return(BadRequest()); } _context.Entry(shoppingList).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShoppingListExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <Item> Add(Item item) { _context.Items.Add(item); await _context.SaveChangesAsync(); return(item); }