public ActionResult BuildCities()
        {
            BuildCities bCities = new BuildCities();
            List<City> cList = new List<City>();
            CitiesDAL cDal = new CitiesDAL();

            cList = cDal.getAllCitiesFromDb();

            return View(cList);
        }
        public ActionResult ShowCitiesGraphically()
        {
            List<City> cList = new List<City>();
            CitiesDAL cDal = new CitiesDAL();
            List<Museum> mList = new List<Museum>();
            MuseumDAL mDal = new MuseumDAL();
            List<Park> pList = new List<Park>();
            ParkDAL pDal = new ParkDAL();

            cList = cDal.getAllCitiesFromDb(true);
            mList = mDal.getAllMuseumsFromDb(true);
            pList = pDal.getAllParksFromDb(true);

            //System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
             //new System.Web.Script.Serialization.JavaScriptSerializer();
            //string sJSON = oSerializer.Serialize(cList);
             var serializerSettings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects };
             string cjson = JsonConvert.SerializeObject(cList, Formatting.Indented, serializerSettings);
             string mjson = JsonConvert.SerializeObject(mList, Formatting.Indented, serializerSettings);
             string pjson = JsonConvert.SerializeObject(pList, Formatting.Indented, serializerSettings);
             //string sjson2 = JsonConvert.ToString(cList[0]);
            ViewData["Cities"] = cjson;
            ViewData["Museums"] = mjson;
            ViewData["Parks"] = pjson;

            return View(cList);
        }
        public BuildCities()
        {
            // list of all museums in dB
            // list of all other venues to follow
            List<Museum> ms = new List<Museum>();
            List<Park> ps = new List<Park>();
            // temporary list of cities
            List<City> cs = new List<City>();
            MuseumDAL mDal = new MuseumDAL();
            ParkDAL pDal = new ParkDAL();

            ms = mDal.getAllMuseumsFromDb();

            foreach (Museum m in ms)
            {
                bool notFound = true;
                foreach (City c in cs)
                {
                    if (m.cityStr.Equals(c.lname))
                    {
                        // Add museum to list of this city's museums
                        c.museums.Add(m);
                        notFound = false;
                        break;
                    }
                }
                if (notFound)
                {
                    City addCity = new City();
                    addCity.lname = m.cityStr;
                    addCity.latitude = m.latitude;
                    addCity.longitude = m.longitude;
                    // Add museum to list of this city's museums
                    //addCity.museums = new List<Museum>();
                    addCity.museums.Add(m);
                    cs.Add(addCity);
                }
            }

            // Do this again for each other venue
            ps = pDal.getAllParksFromDb();
            foreach (Park p in ps)
            {
                bool notFound = true;
                foreach (City c in cs)
                {
                    if (p.cityStr.Equals(c.lname))
                    {
                        // Add museum to list of this city's museums
                        c.parks.Add(p);
                        notFound = false;
                        break;
                    }
                }
                if (notFound)
                {
                    City addCity = new City();
                    addCity.lname = p.cityStr;
                    addCity.latitude = 79.0;
                    addCity.longitude = 79.0;
                    // Add museum to list of this city's museums
                    //addCity.museums = new List<Museum>();
                    addCity.parks.Add(p);
                    cs.Add(addCity);
                }
            }

            // We have created our temporary list of cities, now add them to the dB
            CitiesDAL cDal = new CitiesDAL();
            List<City> lCitiesInDB = new List<City>();
            lCitiesInDB = cDal.getAllCitiesFromDb();
            bool result = false, notIndB = true;
            foreach (City c in cs)
            {
                foreach (City dcb in lCitiesInDB)
                {
                    if (dcb.lname.Equals(c.lname))
                    {
                        notIndB = false;
                        break;
                    }
                }
                if (notIndB)
                {
                    result = cDal.addCityToDb(c);
                    if (result.Equals(false))
                    {
                        //do something
                    }
                }
                notIndB = true;
                // see if it has an id now
            }
        }