public ActionResult Create(City city) { if (ModelState.IsValid) { db.Cities.Add(city); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CountryID = new SelectList(db.Provinces, "CountryID", "ProvinceName", city.CountryID); return View(city); }
public ActionResult Edit(City city) { if (ModelState.IsValid) { db.Entry(city).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CountryID = new SelectList(db.Provinces, "CountryID", "ProvinceName", city.CountryID); return View(city); }