コード例 #1
0
        public async Task <List <PowerStrip> > GetAllStrips()
        {
            MqttService.MqttService lService = await GetMqttService();

            List <PowerStrip> result = lService.GetPowerStrips().ToList();

            return(result);
        }
コード例 #2
0
        public async Task <IHttpActionResult> GetStrip(string id)
        {
            MqttService.MqttService lService = await GetMqttService();

            var strips = lService.GetPowerStrips().ToList();
            var strip  = strips.FirstOrDefault((p) => p.DeviceId == id);

            if (strip == null)
            {
                return(NotFound());
            }
            return(Ok(strip));
        }