Ejemplo n.º 1
0
        public ActionResult Create(Province province)
        {
            if (ModelState.IsValid)
            {
                db.Provinces.Add(province);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "CountryName", province.CountryID);
            return View(province);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Province province)
 {
     if (ModelState.IsValid)
     {
         db.Entry(province).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "CountryName", province.CountryID);
     return View(province);
 }