public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { Moderator moderator = MyAuthHelper.GetLogiranogModeratora(context.HttpContext); if (moderator == null) { ErrorAndRedirect(context); return; } MyContext db = context.HttpContext.RequestServices.GetService <MyContext>(); if (_moderator && db.Moderators.Any(m => m.UserID == moderator.UserID)) { await next(); return; } ErrorAndRedirect(context); }
public IActionResult Logout() { MyAuthHelper.RemoveCurrentSession(HttpContext); return(RedirectToAction(nameof(Index), "Home", new { area = "" })); }