// GET: Bank public ActionResult Index() { BankIndexViewModel model = new BankIndexViewModel(); List<string> Numbers; string userName = User.Identity.Name; using (BankContext context = new BankContext()) { Numbers = (from a in context.Accounts where a.Username == userName select a.AccountNumber).ToList(); } model.AccountNumbers = Numbers; return View(model); }
public ActionResult Index2() { BankIndexViewModel model = new BankIndexViewModel(); List<Pair> Accounts; string userName = User.Identity.Name; using (BankContext context = new BankContext()) { Accounts = (from a in context.Accounts where a.Username == userName select new Pair { First = a.AccountNumber, Second = a.AccountId.ToString() }).ToList(); } model.Accounts = Accounts; return View(model); }