public override void OnActionExecuting(ActionExecutingContext context) { if (HelperController.VerificaUserLogado(HttpContext.Session)) { ViewBag.Logado = true; ViewBag.TipoUsuario = (EnumTipoUsuario)Convert.ToInt32(HttpContext.Session.GetString("TipoUsuario")); base.OnActionExecuting(context); } else { ViewBag.Logado = false; base.OnActionExecuting(context); } }
public override void OnActionExecuting(ActionExecutingContext context) { if (this.GetType().Name.ToUpper().Contains("USUARIOCONTROLLER")) { ViewBag.Logado = true; ViewBag.TipoUsuario = (EnumTipoUsuario)Convert.ToInt32(HttpContext.Session.GetString("TipoUsuario")); base.OnActionExecuting(context); } else { if (!HelperController.VerificaUserLogado(HttpContext.Session)) { context.Result = RedirectToAction("Index", "Login"); } else { ViewBag.Logado = true; ViewBag.TipoUsuario = (EnumTipoUsuario)Convert.ToInt32(HttpContext.Session.GetString("TipoUsuario")); base.OnActionExecuting(context); } } }