Esempio n. 1
0
        public List <Weather2020Forecast> getForecastList(double latitude, double longitude)
        {
            List <Weather2020Forecast> forecastList = new List <Weather2020Forecast>();
            Out output = new Out();

            restClient.endpoint = weather2020Endpoint.getConditions(latitude, longitude);
            string response = restClient.makeRequest();

            output.outputToConsole($"{response}");


            JSONParser <Weather2020Model> jsonParser = new JSONParser <Weather2020Model>();

            Weather2020Model deserialisedWeather2020Model = new Weather2020Model();

            deserialisedWeather2020Model = new deserializeJSON <List <Weather2020Model> >(response);
            //     public System.Xml.XmlDictionaryString RootName { get; set; }
            // output.outputToConsole($"{deserialisedWeather2020Model.Group}");


            /*foreach (Group forecastMain in deserialisedWeather2020Model)
             * {
             *
             *  forecastList.Add(new Weather2020Forecast(forecastMain.startDate, forecastMain.temperatureHighCelcius));
             * }*/
            return(forecastList);
        }
        public List <Weather2020Forecast> getForecastList(double latitude, double longitude)
        {
            List <Weather2020Forecast> forecastList = new List <Weather2020Forecast>();

            restClient.endpoint = weather2020Endpoint.getConditions(latitude, longitude);
            string response = restClient.makeRequest();



            JSONParser <List <Group> > jsonParser = new JSONParser <List <Group> >();


            var deserialisedWeather2020Model = jsonParser.parseJSON(response, Parser.Version.NETCore2);

            foreach (var forecastMain in deserialisedWeather2020Model)
            {
                forecastList.Add(new Weather2020Forecast(forecastMain.startDate, forecastMain.temperatureHighCelcius));
            }
            return(forecastList);
        }