public override void OnActionExecuting(ActionExecutingContext filterContext) { Logger.Trace("OnActionExecuting"); var batchId = filterContext.ActionParameters["id"].ToString() .ToNullableInt32(); var batch = Batches.GetById(batchId.Value) .Include(b => b.Fund) .FirstOrDefault(); filterContext.Controller.ViewBag.FundContext = batch.Fund; }