Beispiel #1
0
        public async Task <IActionResult> Get([FromRoute] string panelId)
        {
            var panel = await _panelRepository.GetPanelBySerial(panelId);

            if (panel == null)
            {
                return(NotFound());
            }

            var analytics = await _analyticsRepository.ReturnOneHourElectricity(panelId);

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

            return(Ok(result));
        }