public override void OnActionExecuting(ActionExecutingContext filterContext) { Logger.Trace("OnActionExecuting"); var clientId = filterContext.ActionParameters["id"].ToString() .ToNullableInt32(); var client = Clients.GetById(clientId.Value) .FirstOrDefault(); filterContext.Controller.ViewBag.ClientContext = client; var fund = Funds.All() .FirstOrDefault(f => f.FundType.Code == "651"); filterContext.Controller.ViewBag.FundContext = fund; }
public override void OnActionExecuting(ActionExecutingContext filterContext) { Logger.Trace("OnActionExecuting"); var orderId = filterContext.ActionParameters["id"].ToString() .ToNullableInt32(); var order = Orders.GetById(orderId.Value) .Include(o => o.Residency.Client) .FirstOrDefault(); if (order != null) { filterContext.Controller.ViewBag.OrderContext = order; filterContext.Controller.ViewBag.ClientContext = order.Residency.Client; var fund = Funds.All() .FirstOrDefault(f => f.FundType.Code == "651"); filterContext.Controller.ViewBag.FundContext = fund; } }