public ActionResult UpdateDevice([FromBody] Device device, int id)
 {
     if (deviceBusiness.GetDeviceById(id) == null)
     {
         return(NotFound());
     }
     else
     {
         deviceBusiness.UpdateDevice(device, id);
         return(Ok());
     }
 }
Ejemplo n.º 2
0
        public void CheckDevice()
        {
            DateTime Now = DateTime.UtcNow.AddHours(7);

            DateTime checkTime = Now.AddSeconds(-(int)Business.Dictionary.Time.CheckDeviceTime);

            List <Device> deviceList = deviceBusiness.GetDeviceListByActiveTimeAndState(checkTime, (int)Business.Dictionary.DeviceState.Offline);

            foreach (var item in deviceList)
            {
                item.State = (int)Business.Dictionary.DeviceState.Offline;
                deviceBusiness.UpdateDevice(item);
                Clients.Group(item.Account.Channel).GetSensorData(item.DeviceId, (int)Business.Dictionary.DeviceState.Offline, "");
                notification.SendWarningNotRespondNotification(item);
            }
        }