public ActionResult UpdatePost(PostPO form)
        {
            ActionResult response = null;
            int          userId   = 0;
            int          userRole = 0;

            if (Session["RoleID"] != null)
            {
                //get the role ID and user ID from session
                int.TryParse(Session["UserID"].ToString(), out userId);
                int.TryParse(Session["RoleID"].ToString(), out userRole);
            }

            if (userId == form.UserId || userRole == 1 || userRole == 2)
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        PostDO dataObject = PostMapper.PostPOToDO(form);
                        _dataAccess.UpdatePost(dataObject);
                        response = RedirectToAction("ViewPostsByThreadId", "Post", new { ThreadId = form.ThreadId });
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Fatal", ex.TargetSite.ToString(), ex.Message, ex.StackTrace);
                    }
                }
                else
                {
                    response = View();
                }
            }
            else
            {
                response = View(form);
            }
            return(response);
        }
        public ActionResult AddPost(PostPO form)
        {
            ActionResult response = null;

            if (ModelState.IsValid)
            {
                try
                {
                    PostDO dataObject = PostMapper.PostPOToDO(form);
                    _dataAccess.AddPost(dataObject);
                    response = RedirectToAction("ViewPostsByThreadId", "Post", new { ThreadId = form.ThreadId });
                }
                catch (Exception ex)
                {
                    Logger.Log("Fatal", ex.TargetSite.ToString(), ex.Message, ex.StackTrace);
                }
            }
            else
            {
                response = View(form);
            }
            return(response);
        }