public async Task UpdateDeviceTwinDesiredFeatureAsync(DeviceTwinDesiredSingleFeatureModel deviceTwinFeaturesModel) { try { dynamic features = new ExpandoObject(); features.features = new Dictionary <string, bool>(); features.features[deviceTwinFeaturesModel.Feature.Name] = deviceTwinFeaturesModel.Feature.IsActivated; await UpdateDeviceSync(deviceTwinFeaturesModel.DeviceId, JsonConvert.SerializeObject(features), null); } catch (Exception e) { Log.Error("Get IoTHub Device Twin Features error {@error}", e.Message); throw e; } }
public async Task <IActionResult> UpdateDeviceTwinDesiredFeature([FromBody] DeviceTwinDesiredSingleFeatureModel deviceTwinFeatureModel) { try { logger.LogInformation("Update DeviceTwin Properties Features called for deviceId- {0}, feature- {1}", deviceTwinFeatureModel.DeviceId, deviceTwinFeatureModel.Feature); await _deviceServiceDB.UpdateDeviceTwinDesiredFeatureAsync(deviceTwinFeatureModel); return(Ok(true)); } catch (Exception e) { logger.LogError(e, "Update DeviceTwin Properties Features - Exception {0}, for deviceId- {1}, feature- {2}", e.Message, deviceTwinFeatureModel.DeviceId, deviceTwinFeatureModel.Feature); throw; } }
public async Task <IActionResult> ActivateFeature([FromBody] DeviceTwinDesiredSingleFeatureModel deviceTwinFeatureModel) { try { logger.LogInformation("Update DeviceTwin Properties Features update called, deviceId - {deviceId}, feature - {feature}", deviceTwinFeatureModel.DeviceId, deviceTwinFeatureModel.Feature); await _deviceTwinRepo.UpdateDeviceTwinDesiredFeatureAsync(deviceTwinFeatureModel); return(Ok()); } catch (Exception e) { logger.LogError(e, "Update DeviceTwin Properties Features update- Exception,, deviceId - {deviceId}, feature - {feature}", deviceTwinFeatureModel.DeviceId, deviceTwinFeatureModel.Feature); throw; } }
public async Task UpdateDeviceTwinDesiredFeatureAsync(DeviceTwinDesiredSingleFeatureModel deviceTwinFeaturesModel) { await _DeviceTwinRepo.UpdateDeviceTwinDesiredFeatureAsync(deviceTwinFeaturesModel); }