private IActionResult updateExpense(ExpectedExpense expectedExpenseItem, ExpectedExpense expectedExpense) { ApplicationUser currentUser = getCurrentUser(); if (expectedExpenseItem.User.UserName != currentUser.UserName) { return HttpBadRequest(); } expectedExpenseItem.Value = expectedExpense.Value; expectedExpenseItem.EncryptedValue = expectedExpense.EncryptedValue; expectedExpenseItem.Deleted = expectedExpense.Deleted; expectedExpenseItem.encryptValue(); UpdateExpectedExpense(expectedExpenseItem); expectedExpenseItem.decryptValue(); return new ObjectResult(expectedExpenseItem); }
private void UpdateExpectedExpense(ExpectedExpense expectedExpense) { apiContext.Entry(expectedExpense).State = EntityState.Modified; apiContext.SaveChanges(); }