public async Task <IActionResult> PutGrocery(long id, Grocery grocery) { if (id != grocery.Id) { return(BadRequest()); } _context.Entry(grocery).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroceryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutExpense(long id, Expense expense) { if (id != expense.Id) { return(BadRequest()); } _context.Entry(expense).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExpenseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }