Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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)));
 }