public IActionResult Login(Account account)
        {
            Claim   name = User.FindFirst(ClaimTypes.Name);
            Account acc  = AccountDTO.LoginAsync(account);

            if (acc != null)
            {
                SercurityManager.Login(this.HttpContext, acc);
                return(RedirectToAction("", "home"));
            }
            TempData["error"] = "Sai tên tài khoản hoặc mật khẩu";
            return(View());
        }
        public IActionResult Login(AccountView account)
        {
            AccountView accountView = AccountDTO.Login(account.Email, account.Password);

            if (accountView != null)
            {
                SercurityManager.Login(this.HttpContext, accountView);
                return(RedirectToAction("index", "home")); // Chỗ quan trọng: bắt buộc return Redirect để refresh lại trang (refresh lại httpContext, nó mới nhận được cookie, nhiều người chỉ để return View() => ko nhận được cookie)
            }
            else
            {
                ViewBag.Error = "Error: Sai tên tài khoản hoặc mật khẩu.";
                return(View("login"));
            }
        }
 public IActionResult Logout()
 {
     SercurityManager.Logout(this.HttpContext);
     return(RedirectToAction("login", "account"));
 }
 public IActionResult Logout()
 {
     SercurityManager.Logout(this.HttpContext);
     return(RedirectToAction("index", "home"));
 }