Example #1
0
 public ActionResult Create(Country country)
 {
     if (ModelState.IsValid)
     {
         _db.Countries.Add(country);
         _db.SaveChanges();
         Success("Your information was saved!");
         return RedirectToAction("Index");
     }
     Error("there were some errors in your form.");
     return View(country);
 }
Example #2
0
 public ActionResult Edit(Country country)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(country).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View("Create", country);
 }