Exemplo n.º 1
0
        public static async Task <string> TemperatureResponse(string dateParam)
        {
            var blobDataTemperature = await FetchDataService.CallBlobAPI(blobURI + "/temperature/" + dateParam + ".csv");

            var outgoingObjAsList = new List <TemperatureObj>();

            var listofTemperatures = blobDataTemperature.Split("\r\n").ToList();

            foreach (var temperature in listofTemperatures)
            {
                if (!string.IsNullOrEmpty(temperature))
                {
                    var            temperatureLine = temperature.Split(";");
                    TemperatureObj outgoingJson    = new TemperatureObj()
                    {
                        PointInTime = temperatureLine[0],
                        Temperature = temperatureLine[1]
                    };
                    outgoingObjAsList.Add(outgoingJson);
                }
            }
            return(JsonSerializer.Serialize(outgoingObjAsList));
        }
Exemplo n.º 2
0
        public static async Task <string> HumidityResponse(string dateParam)
        {
            var blobDataHumidity = await FetchDataService.CallBlobAPI(blobURI + "/humidity/" + dateParam + ".csv");

            var outgoingObjAsList = new List <HumidityObj>();

            var listofHumidities = blobDataHumidity.Split("\r\n").ToList();

            foreach (var humidity in listofHumidities)
            {
                if (!string.IsNullOrEmpty(humidity))
                {
                    var         humidityLine = humidity.Split(";");
                    HumidityObj outgoingJson = new HumidityObj()
                    {
                        PointInTime = humidityLine[0],
                        Humidity    = humidityLine[1]
                    };
                    outgoingObjAsList.Add(outgoingJson);
                }
            }
            return(JsonSerializer.Serialize(outgoingObjAsList));
        }
Exemplo n.º 3
0
        public static async Task <string> RainfallResponse(string dateParam)
        {
            var blobDataRainfall = await FetchDataService.CallBlobAPI(blobURI + "/rainfall/" + dateParam + ".csv");

            var outgoingObjAsList = new List <RainfallObj>();

            var listofRainfalls = blobDataRainfall.Split("\r\n").ToList();

            foreach (var Rainfall in listofRainfalls)
            {
                if (!string.IsNullOrEmpty(Rainfall))
                {
                    var         rainfallLine = Rainfall.Split(";");
                    RainfallObj outgoingJson = new RainfallObj()
                    {
                        PointInTime = rainfallLine[0],
                        Rainfall    = rainfallLine[1]
                    };
                    outgoingObjAsList.Add(outgoingJson);
                }
            }
            return(JsonSerializer.Serialize(outgoingObjAsList));
        }