Example #1
0
        // Feature: List all users
        // Requirements:
        //      Only users with checking accounts
        public IEnumerable <BankAppUser> GetAllUsersWithCheckingAccounts()
        {
            var users             = _bankDAO.GetBankUsers();
            var usersWithChecking = new List <BankAppUser>();


            foreach (var u in users)
            {
                if (_bankDAO.GetBankAccountsBy(u.EntityId).Any(a => a.BankAccountTypeValue == (int)BankAccountType.Checking))
                {
                    usersWithChecking.Add(new BankAppUser()
                    {
                        DOB       = u.DOB.ToString(),
                        EntityId  = u.EntityId,
                        FirstName = u.FirstName,
                        Surname   = u.Surname,
                        Username  = u.Username

                                    // Not including the password and salt
                    });
                }
            }



            return(usersWithChecking);
        }
Example #2
0
        public ISet <BankAccount> GetBankAccounts(BankAppUser bankAppUser)
        {
            var accountEntities = _bankDAO.GetBankAccountsBy(bankAppUser.EntityId);

            var bankAccounts = accountEntities.Select(x => new BankAccount()
            {
                Balance     = x.Balance,
                Owner       = bankAppUser,
                AccountType = (BankAccountType)x.BankAccountTypeValue,
                EntityId    = x.EntityId
            }).ToHashSet();


            return(bankAccounts);
        }