public async Task <ActionResult> Login(LoginModel model, string returnUrl)
        {
            (bool success, Role role) = await UserFacade.AuthorizeUserAsync(model.Username, model.Password);

            if (success)
            {
                //FormsAuthentication.SetAuthCookie(model.Username, false);

                var authTicket = new FormsAuthenticationTicket(1, model.Username, DateTime.Now,
                                                               DateTime.Now.AddMinutes(30), false, role.ToString());
                string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                HttpContext.Response.Cookies.Add(authCookie);

                var decodedUrl = "";
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    decodedUrl = Server.UrlDecode(returnUrl);
                }

                if (Url.IsLocalUrl(decodedUrl))
                {
                    return(Redirect(decodedUrl));
                }
                return(RedirectToAction("Index", "Home"));
            }
            ModelState.AddModelError("", "Wrong username or password!");
            return(View());
        }