Ejemplo n.º 1
0
        private List <SelectListItem> BuildAccountList(bool addAllItem)
        {
            // Build the player group list
            List <SelectListItem> acctitems = new List <SelectListItem>();

            // Add an 'All' item at the top
            if (addAllItem)
            {
                SelectListItem all = new SelectListItem();
                all.Text  = "All Accounts";
                all.Value = "0";
                acctitems.Add(all);
            }

            IAccountRepository    acctrep = new EntityAccountRepository();
            IEnumerable <Account> accts   = acctrep.GetAllAccounts();

            foreach (Account acct in accts)
            {
                SelectListItem item = new SelectListItem();
                item.Text  = acct.AccountName;
                item.Value = acct.AccountID.ToString();

                acctitems.Add(item);
            }

            return(acctitems);
        }
Ejemplo n.º 2
0
        private List <SelectListItem> BuildAccountList(int accountid)
        {
            // Build the account list
            List <SelectListItem> accountitems = new List <SelectListItem>();

            IAccountRepository    acctrep  = new EntityAccountRepository();
            IEnumerable <Account> accounts = acctrep.GetAllAccounts();

            foreach (Account account in accounts)
            {
                SelectListItem item = new SelectListItem();
                item.Text  = account.AccountName;
                item.Value = account.AccountID.ToString();
                accountitems.Add(item);
            }

            return(accountitems);
        }