Пример #1
0
 public IActionResult Index()
 {
     ViewBag.Logado = HelperControllers.VerificaUserLogado(HttpContext.Session);
     if (ViewBag.Logado == true)
     {
         return(RedirectToAction("Index", "OS"));
     }
     else
     {
         return(View());
     }
 }
Пример #2
0
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     if (!HelperControllers.VerificaUserLogado(HttpContext.Session))
     {
         context.Result = RedirectToAction("Index", "Login");
     }
     else
     {
         ViewBag.Logado = true;
         base.OnActionExecuting(context);
     }
 }
Пример #3
0
        public IActionResult FazLogin(string usuario, string senha)
        {
            LoginDAO lDao = new LoginDAO();

            if (lDao.VerificaUsuario(usuario, senha))
            {
                HttpContext.Session.SetString("Logado", "true");
                ViewBag.Logado = HelperControllers.VerificaUserLogado(HttpContext.Session);
                return(RedirectToAction("Index", "OS"));
            }
            else
            {
                ViewBag.Erro = "Usuário ou senha inválidos!";
                return(View("Index"));
            }
        }