Ejemplo n.º 1
0
        public IActionResult GetMetricsFromAgent([FromRoute] DateTimeOffset fromTime, [FromRoute] DateTimeOffset toTime)
        {
            _logger.LogInformation($"Запрос метрики HDD");

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

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

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

            return(Ok(response));
        }