public void DeleteTopic(int id = 0) { try { FaqTopic tmp = new FaqTopic { 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 EditTopic(int id = 0) { // Get the FAQ to be edited FaqTopic topic = new FaqTopic { ID = id }; topic.Get(); ViewBag.topic = topic; try { FaqTopic tmp = (FaqTopic)TempData["topic"]; if (tmp != null) { ViewBag.topic = tmp; } } catch (Exception) { } if (TempData["error"] != null) { ViewBag.error = TempData["error"].ToString(); } return View(); }