Exemplo n.º 1
0
 public ActionResult EditFAQ(FAQ editFAQ)
 {
     if (ModelState.IsValid)
     {
         context.Entry(editFAQ).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("FAQ");
     }
     return PartialView("_EditFAQ", editFAQ);
 }
Exemplo n.º 2
0
 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");
 }