public ActionResult EditPerson(Person p) { if (ModelState.IsValid) { if (dbm.updatePerson(p)) { string output = p.fullName() + " has been updated"; TempData["Success"] = output; } else { string output = p.fullName() + " could not be updated"; TempData["Failure"] = output; } return RedirectToAction("People"); } return View(p); }
public ActionResult CreatePerson(Person p) { if (ModelState.IsValid) { if(dbm.addWorker(p)) { String output = p.fullName() + " has been added to database"; TempData["Success"] = output; } else { String output = "person id has to be unique"; TempData["Failure"] = output; } return RedirectToAction("People"); } return View(); }