示例#1
0
        public List <LiabilityViewModel> GetLiabilityAccounts()
        {
            var liability = glactRepo.GetByMainCategory(MainGlCategory.Liability);

            var allLiabilityAccounts = new List <LiabilityViewModel>();

            foreach (var account in liability)
            {
                var model = new LiabilityViewModel();
                model.AccountName = account.AccountName;
                model.Amount      = account.AccountBalance;

                allLiabilityAccounts.Add(model);
            }
            //adding customer's savings and loan accounts since they are liabilities to the bank
            var savingsAccounts  = new CustomerAccountRepository().GetByType(AccountType.Savings);
            var savingsLiability = new LiabilityViewModel();

            savingsLiability.AccountName = "Savings Accounts";
            savingsLiability.Amount      = savingsAccounts != null?savingsAccounts.Sum(a => a.AccountBalance) : 0;

            var currentAccounts  = new CustomerAccountRepository().GetByType(AccountType.Current);
            var currentLiability = new LiabilityViewModel();

            currentLiability.AccountName = "Current Accounts";
            currentLiability.Amount      = currentAccounts != null?currentAccounts.Sum(a => a.AccountBalance) : 0;

            allLiabilityAccounts.Add(savingsLiability);
            allLiabilityAccounts.Add(currentLiability);
            return(allLiabilityAccounts);
        }//end method
示例#2
0
        public List <GlAccount> GetAssetAccounts()
        {
            var allAssets = glactRepo.GetByMainCategory(MainGlCategory.Asset);// db.GlAccounts.Where(g => g.GlCategory.MainCategory == Core.Models.MainGlCategory.Asset).ToList();

            GlAccount loanAsset = new Core.Models.GlAccount();

            loanAsset.AccountName = "Loan Accounts";
            var loanAccounts = new CustomerAccountRepository().GetByType(AccountType.Loan);

            foreach (var act in loanAccounts)
            {
                loanAsset.AccountBalance += act.AccountBalance;
            }
            allAssets.Add(loanAsset);
            return(allAssets);
        }