Beispiel #1
0
        public ActionResult Index(CountriesAndCitiesModel myWrapper)
        {
            using (CountriesDB context = new Models.CountriesDB())
            {
                var countries = context.Countries.ToList();
                var cities    = context.Cities.ToList();

                myWrapper.countries = countries;
                myWrapper.cities    = context.Cities
                                      .Where(c => c.CountryID == myWrapper.SelectionId).ToList();

                return(View(myWrapper));
            }
        }
Beispiel #2
0
        // GET: Index
        public ActionResult Index()
        {
            using (CountriesDB context = new Models.CountriesDB())
            {
                var countries = context.Countries.ToList();
                var cities    = context.Cities.ToList();

                var Model = new CountriesAndCitiesModel()
                {
                    countries = countries,
                    cities    = cities
                };

                return(View(Model));
            }
        }