public ActionResult AddThread(ThreadPO form) { ActionResult response = null; if (ModelState.IsValid) { try { //maps and adds the user inputted thread information to the database ThreadDO dataObject = ThreadMapper.ThreadPOToDO(form); _threadDataAccess.AddThread(dataObject); //sends user back to the list of threads page response = RedirectToAction("Index", "Thread"); } catch (Exception ex) { Logger.Log("Fatal", ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } } else { response = View(form); } return(response); }
public static ThreadDO ThreadPOToDO(ThreadPO from) { ThreadDO to = new ThreadDO(); to.ThreadId = from.ThreadId; to.Title = from.Title; to.Information = from.Information; return(to); }
public ActionResult UpdateThread(int threadId) { ActionResult response = null; try { //shows the update form for the thread that was clicked ThreadDO dataObject = _threadDataAccess.ViewThreadByID(threadId); ThreadPO displayObject = ThreadMapper.ThreadDOToPO(dataObject); response = View(displayObject); } catch (Exception ex) { Logger.Log("Fatal", ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } return(response); }
public ActionResult UpdateThread(ThreadPO form) { ActionResult response = null; if (ModelState.IsValid) { try { //updates the thread with user inputted information ThreadDO dataObject = ThreadMapper.ThreadPOToDO(form); _threadDataAccess.UpdateThread(dataObject); response = RedirectToAction("Index", "Thread"); } catch (Exception ex) { Logger.Log("Fatal", ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } } else { response = View(form); } return(response); }