Esempio n. 1
0
        public async Task <List <Expense> > UpdateExpensesWhen(ExpenseRecipientCategoryChanged notification)
        {
            if (!notification.NewExpenseCategoryId.HasValue)
            {
                return(new List <Expense>());
            }

            var expenses = await _expenseRepository.FindByExpenseRecipientAndMonthGreaterThen(notification.ExpenseRecipientId, notification.ExpenseMonth);

            foreach (var expense in expenses)
            {
                //todo: create justThisOnce flag and exclude those expenses
                expense.SetExpenseCategory(notification.NewExpenseCategoryId);
            }

            return(expenses);
        }