示例#1
0
        public async Task <List <Expense> > UpdateExpensesWhen(PosTerminalAdded notification)
        {
            var expenseRecipient =
                await _expenseRecipientRepository.FindById(notification.ExpenseRecipientId);

            if (expenseRecipient == null)
            {
                return(new List <Expense>());
            }

            var expenses = await _expenseRepository.FindByPosTerminal(notification.PosTerminal);

            foreach (var expense in expenses)
            {
                expense.SetExpenseRecipient(expenseRecipient.ExpenseRecipientId);
                expense.SetExpenseCategory(expenseRecipient.ExpenseCategoryId);
            }

            return(expenses);
        }