public override void OnActionExecuting(ActionExecutingContext context) { if (MyTeamQuery.Any() == false) { throw new UnauthorizedAccessException("User has no access to a team"); } base.OnActionExecuting(context); }
public IActionResult Index() { var faq = DbContext .CommonQuestion .Where(e => e.Contest.Year == MyTeamQuery.Select(t => t.Contest.Year).Single()) .ToList(); FillViewBag(); return(View(faq)); }