public void LoadAccounts()
 {
     Accounts.Clear();
     foreach (var account in AccountsModel.GetAccounts())
     {
         Accounts.Add(account);
     }
 }
Beispiel #2
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            // Request list of accounts
            IReadOnlyList <AccountModel> accounts = _accounts.GetAccounts();
            List <string> list = accounts
                                 .Select(m => m.Name)
                                 .ToList();

            list.Sort();

            return(new StandardValuesCollection(list));
        }
        public void LoadAccounts()
        {
            AppAccount[] appAccounts = AccountsModel.GetAccounts().Select(b => new AppAccount()
            {
                Id                    = b.Id.Value,
                FirstName             = b.FirstName,
                LastName              = b.LastName,
                PhoneNumber           = b.PhoneNumber,
                EditAccountCommand    = new ActionCommand((o) => EditAccount(b.Id.Value)),
                ShowTakenBooksCommand = new ActionCommand((o) => ShowTakenBooks(b.Id.Value)),
                DeleteAccountCommand  = new ActionCommand((o) => DeleteAccount(b.Id.Value))
            }).ToArray();

            Accounts.Clear();

            foreach (AppAccount appAccount in appAccounts)
            {
                Accounts.Add(appAccount);
            }
        }