public ActionResult EditFAQ(FAQ editFAQ) { if (ModelState.IsValid) { context.Entry(editFAQ).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("FAQ"); } return PartialView("_EditFAQ", editFAQ); }
public ActionResult NewFAQ(FAQ newFAQ) { try { if (ModelState.IsValid) { context.FAQSet.Add(newFAQ); context.SaveChanges(); return RedirectToAction("FAQ"); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return PartialView("_NewFAQ"); }