Example #1
0
        public IActionResult GetPeriod([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            var metrics = repository.GetPeriod(fromTime, toTime);

            var response = new AllNetworkMetricsResponse()
            {
                Metrics = new List <NetworkMetricDto>()
            };

            foreach (var metric in metrics)
            {
                response.Metrics.Add(new NetworkMetricDto {
                    Time = metric.Time, Value = metric.Value, Id = metric.Id
                });
            }

            return(Ok(response));
        }