예제 #1
0
 // 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);
 }
예제 #2
0
        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);

        }