public override void OnActionExecuting(ActionExecutingContext context) { if (HelperController.CheckLogin(HttpContext.Session)) { ViewBag.Login = true; base.OnActionExecuting(context); } }
public override IActionResult Index() { if (!HelperController.CheckLogin(HttpContext.Session)) { ViewBag.Operacao = "I"; UsersViewModel model = new UsersViewModel(); return(View("Form", model)); } else { var list = DAO.List(); return(View(list)); } }
public override void OnActionExecuting(ActionExecutingContext context) { //if (!HelperController.CheckRegister(HttpContext.Session)) // context.Result = RedirectToAction("Create", "Users"); if (!HelperController.CheckLogin(HttpContext.Session)) { context.Result = RedirectToAction("Create", "Users"); } else { ViewBag.Login = true; base.OnActionExecuting(context); } }
public IActionResult Save(T model, string Operation) { PopCombos(); try { ValidateData(model, Operation); if (ModelState.IsValid == false) { ViewBag.Operacao = Operation; return(View("Form", model)); } else { if (Operation == "I") { DAO.Insert(model); if (!HelperController.CheckLogin(HttpContext.Session)) { HttpContext.Session.SetString("Login", "true"); return(RedirectToAction("Index", "Home")); } } else { DAO.Update(model); } return(RedirectToAction("index")); } } catch (Exception erro) { ViewBag.Erro = "Ocorreu um erro: " + erro.Message; ViewBag.Operacao = Operation; return(View("Form", model)); } }
public IActionResult Index() { ViewBag.Login = HelperController.CheckLogin(HttpContext.Session); return(View()); }