예제 #1
0
        public static async Task <DataTableEntity> MapPayloadToTableEntityAsync(string payloadJsonString)
        {
            DataTableEntity dataTableEntity = new DataTableEntity(ConfigReader.PartitionKey, Guid.NewGuid());

            List <PayloadEntity> payloadList = new List <PayloadEntity>();
            PayloadEntity        data        = await GeneralHelpers.ConvertToObject(payloadJsonString);

            payloadList.Add(data);

            foreach (PayloadEntity payload in payloadList)
            {
                dataTableEntity.DataFormat  = payload.DataFormat;
                dataTableEntity.Humidity    = payload.Humidity;
                dataTableEntity.Temperature = payload.Temperature;
                dataTableEntity.Pressure    = payload.Pressure;
                dataTableEntity.Battery     = payload.Battery;
            }

            return(await Task.FromResult(dataTableEntity));
        }