public void DeleteQuestion(int id = 0) { try { FAQ tmp = new FAQ { ID = id }; tmp.Get(); tmp.Delete(); } catch (Exception e) { Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; Response.StatusDescription = e.Message; Response.Write(e.Message); } }
public ActionResult EditQuestion(int id = 0) { // Get the FAQ to be edited FAQ faq = new FAQ { ID = id }; faq.Get(); ViewBag.faq = faq; // Get the topics List<FaqTopic> topics = FaqTopic.GetAll(); ViewBag.topics = topics; try { FAQ tmp = (FAQ)TempData["faq"]; if (tmp != null) { ViewBag.faq = tmp; } } catch (Exception) { } if (TempData["error"] != null) { ViewBag.error = TempData["error"].ToString(); } return View(); }