public ActionResult Login(string username, string password) { ViewBag.Notif = null; if (ModelState.IsValid) { var Dao = new NhanVienDao(); long result = Dao.Login(username, GetMD5(password)); if (result != 0) { var user = Dao.GetByID(result); var UserSession = new UserLogin(); UserSession.Name = user.Ten; UserSession.UserID = user.ID; UserSession.VaiTro = user.ID_VT; var ListCredentials = Dao.GetListCredential(result); Session.Add(CommonConstants.SESSION_CREDENTIAL, ListCredentials); Session.Add(CommonConstants.USER_SESSION, UserSession); return(RedirectToAction("Index", "Home")); } else { ViewBag.Notif = "Đăng nhập không thành công ! Thử lại"; } } return(View("Index")); }