Exemple #1
0
        public List <AccountDetailStruct> GetUserAccounts(uint userID)
        {
            List <AccountDetailStruct> result = new List <AccountDetailStruct>();

            try
            {
                List <uint> accountIDs = access.GetAccountIDsByUser(userID);
                foreach (uint ID in accountIDs)
                {
                    AccountDetailStruct entry = new AccountDetailStruct();

                    access.SelectAccount(ID);
                    entry.accountID = ID;
                    entry.userID    = access.GetOwner();
                    entry.balance   = access.GetBalance();
                    result.Add(entry);
                }
            }
            catch (Exception)
            {
                var response = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content      = new StringContent("User's accounts could not be retreived"),
                    ReasonPhrase = "User could not be found"
                };
                throw new HttpResponseException(response);
            }
            return(result);
        }
Exemple #2
0
        public ArrayList GetAccountIDsByUser(uint userID)
        {
            ArrayList accountsArrayList = new ArrayList();
            var       accounts          = accountAccess.GetAccountIDsByUser(userID);

            accounts.ForEach(account => { accountsArrayList.Add(account); });
            return(accountsArrayList);
        }
Exemple #3
0
 public List <uint> GetAccountIDsByUser(uint userID)
 {
     return(accountAccess.GetAccountIDsByUser(userID));
 }