public async Task ReadPoco() { var temperature = await _reader.QueryAsync <Temperature>(new QueryRange(-7, RangeUnit.day)); temperature.ForEach(t => { Console.WriteLine(t.ToString()); Console.WriteLine(t.ToJson()); }); }
public async Task <IActionResult> Get(string metric, string unit, int range) { _logger.LogInformation($"metric: {metric}; unit: {unit}; range: {range}"); QueryRange queryRange; switch (unit) { case "hour": queryRange = new QueryRange(range, RangeUnit.hour); break; case "day": queryRange = new QueryRange(range, RangeUnit.day); break; default: queryRange = new QueryRange(range, RangeUnit.minute); break; } var data = await _reader.QueryAsync(metric, queryRange); if (data != null) { return(Json(data)); } else { return(NotFound()); } }