public override void OnActionExecuting(ActionExecutingContext context) { ViewBag.Logado = HelperControllers.VerificaUserLogado(HttpContext.Session); ViewBag.Administrador = HelperControllers.VerificaAdministrador(HttpContext.Session); if (ViewBag.Logado) { ViewBag.Nome = HttpContext.Session.GetString("Nickname"); ViewBag.IdUsuario = @Convert.ToInt32(HttpContext.Session.GetString("IdUsuario")); } }
public override void OnActionExecuting(ActionExecutingContext context) { if (!HelperControllers.VerificaUserLogado(HttpContext.Session)) { context.Result = RedirectToAction("Index", "Login"); } else { ViewBag.Administrador = HelperControllers.VerificaAdministrador(HttpContext.Session); ViewBag.Nome = HttpContext.Session.GetString("Nickname"); ViewBag.Logado = true; ViewBag.IdUsuario = @Convert.ToInt32(HttpContext.Session.GetString("IdUsuario")); base.OnActionExecuting(context); } }