public ActionResult Login(AdminLoginViewModel adminLoginViewModel) { if (ModelState.IsValid) { AdminFunc adminFunc = new AdminFunc(); var _response = adminFunc.Verify(adminLoginViewModel.Accounts, adminLoginViewModel.Password); if (_response.Code == 1) { var _user = adminFunc.Find(adminLoginViewModel.Accounts); Session.Add("AdminID", _user.AdministratorID); Session.Add("Accounts", _user.Accounts); adminFunc.UpdateAdminLoginInfo(_user.AdministratorID, DateTime.Now, "127.0.0.1"); return(RedirectToAction("Index", "Admin")); } else if (_response.Code == 3) { ModelState.AddModelError("Accounts Or Password", _response.Message); } else { ModelState.AddModelError("", _response.Message); } } return(View(adminLoginViewModel)); }