Exemplo n.º 1
0
        public async Task <IActionResult> Get([FromRoute] int panelId)
        {
            if (!_panelRepository.Exist(panelId))
            {
                return(NotFound());
            }

            var analytics = await _analyticsRepository.GetByPanelId(panelId);

            var result = new OneHourElectricityListModel
            {
                OneHourElectricitys = analytics.Select(c => new OneHourElectricityModel
                {
                    Id       = c.Id,
                    KiloWatt = c.KiloWatt,
                    DateTime = c.DateTime
                })
            };

            return(Ok(result));
        }