public IActionResult GetPeriod([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime) { var metrics = repository.GetPeriod(fromTime, toTime); var response = new AllHddMetricsResponse() { Metrics = new List <HddMetricDto>() }; foreach (var metric in metrics) { response.Metrics.Add(new HddMetricDto { Time = metric.Time, Value = metric.Value, Id = metric.Id }); } return(Ok(response)); }