Exemple #1
0
        protected async override Task ApplyModifiersAsync(Category category, CategoryModifier modifier)
        {
            if ((modifier.IncludeImage || modifier.IncludeAll) && category.ImageId.HasValue)
            {
                category.Image = await images.GetAsync(category.ImageId.Value);
            }

            if (modifier.IncludeWallets || modifier.IncludeAll)
            {
                var walletCategoryModifier = new WalletCategoryModifier()
                {
                    IncludeWallet = true
                };
                var filter = new WalletCategoryFilter()
                {
                    CategoryId = category.Id
                };
                var wallCats = await walletsCategories.GetAsync(filter, walletCategoryModifier);

                category.Wallets = wallCats.Where(x => x.Wallet != null).Select(x => x.Wallet).ToList();
            }

            if (modifier.IncludeRules || modifier.IncludeAll)
            {
                var filter = new RuleFilter()
                {
                    CategoryId = category.Id
                };
                category.Rules = await rules.GetAsync(filter);
            }
        }
Exemple #2
0
 protected override async Task ApplyModifiersAsync(Wallet wallet, WalletModifier modifier)
 {
     if ((modifier.IncludeImage || modifier.IncludeAll) && wallet.ImageId.HasValue)
     {
         wallet.Image = await images.GetAsync(wallet.ImageId.Value);
     }
 }
Exemple #3
0
        protected override async Task ApplyModifiersAsync(Bank bank, BankModifier modifier)
        {
            if ((modifier.IncludeImage || modifier.IncludeAll) && bank.ImageId.HasValue)
            {
                bank.Image = await images.GetAsync(bank.ImageId.Value);
            }

            if (modifier.IncludeBankAccountInfo || modifier.IncludeAll)
            {
                bank.BankAccountInfo = await bankAccountInfoes.GetAsync(bank.Id);
            }

            if (modifier.IncludeTransactions || modifier.IncludeAll)
            {
                bank.StoredTransactions = await transactions.GetByBankIdAsync(bank.Id);
            }
        }