public int WriteData(Data data)
        {
            try
            {
                DB.City city   = _ctx.Cities.FirstOrDefault(n => n.Id.Equals(data.Idx));
                AQData  aQData = new AQData();

                aQData.PM10        = data.Iaqi.pm10.V;
                aQData.PM25        = data.Iaqi.pm25.V;
                aQData.Temperature = data.Iaqi.t.V;
                aQData.Date        = DateTime.Parse(data.Time.S);
                aQData.Humidity    = data.Iaqi.h.V;


                if (city != null)
                {
                    aQData.CityId = city.Id;
                }
                else
                {
                    DB.City newCity = new DB.City();
                    newCity.Name  = GetShortName(data.City.Name);
                    newCity.Id    = data.Idx;
                    aQData.CityId = data.Idx;
                    _ctx.Cities.Add(newCity);
                }

                _ctx.AQDatas.Add(aQData);
                return(_ctx.SaveChanges());
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        public List <DB.AQData> GetDataByCity(DB.City city)
        {
            List <DB.AQData> aQDatas = new List <AQData>();

            aQDatas = _ctx.AQDatas.Include(c => c.City)
                      .Where(c => c.City.Equals(city))
                      .OrderBy(d => d.Date)
                      .ToList();
            return(aQDatas);
        }