public async Task <IActionResult> UpdateCustomGroup([FromBody] CustomGroupModel customGroup) { logger.LogInformation("Update custom group called"); //Ensure the current user is allowed to edit this template var customGroupItem = await _GroupsRepo.GetItemAsync(customGroup.Id); if (customGroupItem == null) { logger.LogError("Update custom group - Exception: Custom group with id {0} was not found.", customGroup.Id); return(StatusCode(StatusCodes.Status500InternalServerError)); } var groupDetails = _DeviceServiceDB.GetDevicesTwinInfoAsync(new DeviceQueryConfiguration() { ItemsPerPage = 1, Where = customGroup.Where }); customGroup.Count = groupDetails.ItemsCount; //Update Custom Group bool status = await _GroupsRepo.UpdateItemAsync(customGroup.Id, customGroup); if (!status) { logger.LogError("Update custom group - Exception: There was an error while updating the custom group {0}", customGroup.Id); return(StatusCode(StatusCodes.Status500InternalServerError)); } return(Ok(status)); }
public IActionResult GetDevicesTwinList([FromBody] DeviceQueryConfiguration config) { try { logger.LogInformation("Get DeviceTwin Properties called"); DeviceQueryResponse response = _deviceServiceDB.GetDevicesTwinInfoAsync(config); return(Ok(response)); } catch (Exception e) { logger.LogError(e, "Get DeviceTwin Properties- Exception {message}", e.Message); throw; } }