public async Task <ActionResult> Events(string id, string ComputerName = "", string UserName = "") { if (id == null) { throw new HttpException((int)HttpStatusCode.BadRequest, "Missing PoolName"); } var stats = await Svc.GetPoolSummaryAsync(PoolName : id); if (stats == null) { throw new HttpException((int)HttpStatusCode.NotFound, "PoolName was Not found"); } var Events = await Svc.GetEventsAsync(PoolName : id); if (!String.IsNullOrEmpty(ComputerName)) { Events = Events.Where(e => e.ComputerName.Equals(ComputerName, StringComparison.InvariantCultureIgnoreCase)); } if (!String.IsNullOrEmpty(UserName)) { Events = Events.Where(e => e.UserName.Equals(UserName, StringComparison.InvariantCultureIgnoreCase)); } ViewBag.CurrentPool = id; ViewBag.Available = stats.PoolAvailable; ViewBag.Total = stats.PoolCount; ViewBag.InUse = stats.PoolInUse; return(View(Events.OrderByDescending(e => e.DtStamp).Take(Properties.Settings.Default.DashboardMaxEvents))); }