public async Task <IEnumerable <Code> > GetActiveCode([FromRoute] Guid deviceId) { Device dev = await GetDeviceAsync(deviceId); if (dev == null) { return(null); } return(_repository.GetActive(dev)); }
public async Task <IActionResult> Index(Guid deviceId, string searchString) { string srch = StringOperations.PrepareForSearch(searchString); Device dev = await GetDeviceAsync(deviceId); IEnumerable <Code> codes = _repository.GetActive(dev); if (!string.IsNullOrWhiteSpace(srch)) { codes = codes?.Where(g => g.ActionName.Equals(srch)); ViewData["searchInput"] = srch; } List <ChartJSCore.Models.Chart> charts = CreateCharts(dev); ViewData["freq"] = charts[0]; ViewData["compl"] = charts[1]; ViewData[GarduinoConstants.DeviceId] = deviceId; return(View(codes)); }