예제 #1
0
        public IActionResult GetMetricsFromAgent([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            _logger.LogInformation($"Запрос метрики Network с {fromTime} по {toTime}");

            DateTimeOffset timeFrom = fromTime.UtcDateTime;
            DateTimeOffset timeto   = toTime.UtcDateTime;

            var metrics  = _repository.GetByDatePeriod(timeFrom, timeto);
            var response = new AllNetworkMetricsResponse()
            {
                Metrics = new List <NetworkMetricsDto>()
            };

            foreach (var metric in metrics)
            {
                response.Metrics.Add(_mapper.Map <NetworkMetricsDto>(metric));
            }
            return(Ok(response));
        }