Esempio n. 1
0
        // GET: Login
        public ActionResult Index()
        {
            AccountListVM accountListVM = new AccountListVM();
            LoginUserBL   loginUserBL   = new LoginUserBL();

            accountListVM.accountListVM = AccountList2AccountVMList(loginUserBL.GetAccountList());
            return(View(accountListVM));
        }
Esempio n. 2
0
 public ActionResult Login(LoginUser account, string ReturnUrl)
 {
     if (account.username != null && account.password != null)
     {
         LoginUserBL      loginUserBL = new LoginUserBL();
         List <LoginUser> accountList = loginUserBL.GetAccountList();
         Hashing          hashing     = new Hashing();
         LoginUser        user        = accountList.Where(u => u.username == account.username).Single();
         if (user != null && hashing.VerifyMd5Hash(account.password, user.password))
         {
             FormsAuthentication.SetAuthCookie(user.username, false);
             Session["LoginID"]  = user.LoginID.ToString();
             Session["username"] = user.username.ToString();
             if (ReturnUrl == null)
             {
                 return(RedirectToAction("Home", "Home"));
             }
             return(Redirect(ReturnUrl));
         }
         return(View());
     }
     return(View(account));
 }