コード例 #1
0
        public ActionResult Insert()
        {
            var model = new CityCountries
            {
                Countries = countryRepository.Countries.ToList(),
                City = new City()
            };

            return View(model);
        }
コード例 #2
0
        public ActionResult Insert(CityCountries cityCountry)
        {
            if (ModelState.IsValid)
            {
                var city = cityCountry.City;
                cityRepository.Save(city);
                return RedirectToAction("List");
            }

            return View(cityCountry);
        }