public ActionResult Login(string email = "", string password = "") { if (Request.HttpMethod == "GET") { return(View()); } else { //bool result = AccountBLL.Login(email, EncodeMD5.GetMD5(password)); var userAccount = AccountBLL.Athorize(email, EncodeMD5.GetMD5(password), UserAccountTypes.Employee); if (userAccount != null) { WebUserData cookieData = new Admin.WebUserData() { UserID = userAccount.UserID, FullName = userAccount.FullName, GroupName = userAccount.Role, LoginTime = DateTime.Now, SessionID = Session.SessionID, ClientIP = Request.UserHostAddress, Photo = userAccount.Photo }; FormsAuthentication.SetAuthCookie(cookieData.ToCookieString(), false); return(RedirectToAction("Index", "Dashboard")); } else { ModelState.AddModelError("login_error", "Đăng nhập thất bại"); ViewBag.Email = email; ViewBag.Password = password; //ViewBag : Trao đổi dữ liệu return(View()); } } }