public void UpdateExpenses(string userId, List <Expense> expensesToUpdate) { var expenses = _expenseRepository.Find(userId, expensesToUpdate.Select(x => x.Id)); expensesToUpdate.ForEach(n => { var expense = expenses.Single(x => x.Id == n.Id); expense.Description = n.Description; expense.Quantity = n.Quantity; expense.UnitPrice = n.UnitPrice; expense.Price = n.Price; }); _unitOfWork.Save(); }
public async Task <Expense> Find(int id) { var expense = await _expenses.Find(id); return(expense); }
public IActionResult Get(int id) { return(Ok(_expenseRepository.Find(id))); }