Пример #1
0
        public ValuesController()
        {
            ForProjectEntities entities = new ForProjectEntities();



            foreach (AllCO2Facts f in entities.AllCO2Facts.ToList())
            {
                result_co2 = result_co2 + f.ToString();
            }

            foreach (AllHumidityFact f in entities.AllHumidityFacts.ToList())
            {
                result_humidity = result_humidity + f.ToString();
            }


            foreach (AllTemperatureFact f in entities.AllTemperatureFacts.ToList())
            {
                result_temperature = result_temperature + f.ToString();
            }



            int counter = 0;
            int x       = 0;



            var c_co2         = result_co2.Split(',');
            var c_humidty     = result_humidity.Split(',');
            var c_temperature = result_temperature.Split(',');


            for (int i = 0; i < c_co2.Length; i++)
            {
                Readings reading = new Readings();

                int.TryParse(c_co2[i], out x);
                reading.setCo2(x);

                int.TryParse(c_humidty[i], out x);
                reading.setHumidity(x);

                int.TryParse(c_temperature[i], out x);
                reading.setTemperature(x);



                readings.Add(reading);
            }
        }