Example #1
0
        public customerAccount createAccount(int id)
        {
            customerAccount a = new customerAccount
            {
                customerId       = id,
                currentAccountId = (id * 100) + acid,
                savingsAccountId = (id * 100) + (acid + 1)
            };

            customeraccounts.Add(a);
            var cust = customeraccounts.Find(c => c.customerId == id);
            currentAccountDetails ca = new currentAccountDetails
            {
                currentAccountId      = cust.currentAccountId,
                currentAccountBalance = 0.00
            };

            currentAccounts.Add(ca);
            savingsAccount sa = new savingsAccount
            {
                savingsAccountId      = cust.savingsAccountId,
                savingsAccountbalance = 0.00
            };

            savingsAccounts.Add(sa);
            return(cust);
        }
Example #2
0
        public List <accountDetails> getCustomerAccounts(int id)
        {
            customerAccount       a  = customeraccounts.Where(c => c.customerId == id).FirstOrDefault();
            currentAccountDetails ca = currentAccounts.Find(cac => cac.currentAccountId == a.currentAccountId);
            var sa = savingsAccounts.Find(sac => sac.savingsAccountId == a.savingsAccountId);
            List <accountDetails> ac = new List <accountDetails>
            {
                new accountDetails {
                    accountId = ca.currentAccountId, accountType = "Current Account", accountBalance = ca.currentAccountBalance
                },
                new accountDetails {
                    accountId = sa.savingsAccountId, accountType = "Savings Account", accountBalance = sa.savingsAccountbalance
                }
            };

            return(ac);
        }