public ActionResult ShowAllAccounts()
        {
            Account            account            = new Account();
            AccountAccessLayer accountAccessLayer = new AccountAccessLayer();

            account.listAccount = accountAccessLayer.Selectalldata();
            account.account     = (Account)Session["account"];

            return(View(account));
        }
Ejemplo n.º 2
0
        public ActionResult Login(Account objAccount)
        {
            if (ModelState.IsValid)
            {
                AccountAccessLayer accountAccessLayer = new AccountAccessLayer();
                List <Account>     listAccount        = accountAccessLayer.Selectalldata();
                Account            obj = listAccount.Where(a => a.Name.Equals(objAccount.Name) && a.PassWord.Equals(objAccount.PassWord)).FirstOrDefault();
                if (obj != null)
                {
                    Session["account"] = obj;
                    return(RedirectToAction("ShowAllAccounts", "Account"));
                }
                else
                {
                    ModelState.AddModelError("", "Accountname or password is wrong");

                    return(View(objAccount));
                }
            }
            return(View(objAccount));
        }