public async Task <IActionResult> PutExpenses([FromRoute] int id, [FromBody] Expenses expenses) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != expenses.Id) { return(BadRequest()); } _expensesRepository.UpdateExpense(expenses); try { await _expensesRepository.Save(); } catch (DbUpdateConcurrencyException) { if (!ExpensesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }