Ejemplo n.º 1
0
 public ActionResult Create(CityViewModel city)
 {
     if (ModelState.IsValid)
     {
         var province = db.Provinces.Find(city.ProvinceId);
         province.Cities.Add(new City { Name=city.Name });
         db.SaveChanges();
         return RedirectToAction("CityList",new {provinceId = city.ProvinceId });
     }
     return View(city);
 }
Ejemplo n.º 2
0
 public ActionResult Create(int provinceId)
 {
     var model = new CityViewModel() { ProvinceId = provinceId };
     return View(model);
 }