public HttpResponseMessage ApprovePost(ModerationDTO dto)
        {
            var notify = NotificationsController.Instance.GetNotification(dto.NotificationId);

            ParseNotificationContext(notify.Context);

            var fc = new ForumController();

            var fi = fc.Forums_Get(_forumId, -1, false, true);
            if (fi == null)
                return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Forum Not Found" });

            if (!(IsMod(_forumId)))
                return Request.CreateResponse(HttpStatusCode.Forbidden, new { Message = "User is not a moderator for this forum"});

            if (_replyId > 0)
            {
                var rc = new ReplyController();
                var reply = rc.ApproveReply(PortalSettings.PortalId, _tabId, _moduleId, _forumId, _topicId, _replyId);
                if (reply == null)
                    return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Reply Not Found" });
            }
            else
            {
                var tc = new TopicsController();
                var topic = tc.ApproveTopic(PortalSettings.PortalId, _tabId, _moduleId, _forumId, _topicId);
                if (topic == null)
                    return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Topic Not Found" });
            }

            NotificationsController.Instance.DeleteNotification(dto.NotificationId);

            return Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" });
        }
        public HttpResponseMessage ApprovePost(ModerationDTO dto)
        {
            var notify = NotificationsController.Instance.GetNotification(dto.NotificationId);

            ParseNotificationContext(notify.Context);

            var fc = new ForumController();

            var fi = fc.Forums_Get(_forumId, -1, false, true);

            if (fi == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Forum Not Found" }));
            }


            if (!(IsMod(_forumId)))
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden, new { Message = "User is not a moderator for this forum" }));
            }


            if (_replyId > 0)
            {
                var rc    = new ReplyController();
                var reply = rc.ApproveReply(PortalSettings.PortalId, _tabId, _moduleId, _forumId, _topicId, _replyId);
                if (reply == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Reply Not Found" }));
                }
            }
            else
            {
                var tc    = new TopicsController();
                var topic = tc.ApproveTopic(PortalSettings.PortalId, _tabId, _moduleId, _forumId, _topicId);
                if (topic == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Topic Not Found" }));
                }
            }

            NotificationsController.Instance.DeleteNotification(dto.NotificationId);

            return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" }));
        }
        public HttpResponseMessage IgnorePost(ModerationDTO dto)
        {
            var notify = NotificationsController.Instance.GetNotification(dto.NotificationId);

            ParseNotificationContext(notify.Context);

            var fc = new ForumController();
            var fi = fc.Forums_Get(_forumId, -1, false, true);

            if (fi == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Forum Not Found" }));
            }

            if (!(IsMod(_forumId)))
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden, new { Message = "User is not a moderator for this forum" }));
            }

            NotificationsController.Instance.DeleteNotification(dto.NotificationId);
            return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" }));
        }
        public HttpResponseMessage RejectPost(ModerationDTO dto)
        {
            var notify = NotificationsController.Instance.GetNotification(dto.NotificationId);

            ParseNotificationContext(notify.Context);

            var fc = new ForumController();
            var fi = fc.Forums_Get(_forumId, -1, false, true);

            if (fi == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Forum Not Found" }));
            }

            if (!(IsMod(_forumId)))
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden, new { Message = "User is not a moderator for this forum" }));
            }


            var mc = new ModController();

            mc.Mod_Reject(PortalSettings.PortalId, _moduleId, UserInfo.UserID, _forumId, _topicId, _replyId);

            int authorId;

            if (_replyId > 0)
            {
                var rc    = new ReplyController();
                var reply = rc.Reply_Get(PortalSettings.PortalId, _moduleId, _topicId, _replyId);

                if (reply == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Reply Not Found" }));
                }

                authorId = reply.Content.AuthorId;
            }
            else
            {
                var tc    = new TopicsController();
                var topic = tc.Topics_Get(PortalSettings.PortalId, _moduleId, _topicId);
                if (topic == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { Message = "Topic Not Found" }));
                }

                authorId = topic.Content.AuthorId;
            }

            if (fi.ModRejectTemplateId > 0 && authorId > 0)
            {
                var uc = new Entities.Users.UserController();
                var ui = uc.GetUser(PortalSettings.PortalId, authorId);
                if (ui != null)
                {
                    var au = new Author
                    {
                        AuthorId    = authorId,
                        DisplayName = ui.DisplayName,
                        Email       = ui.Email,
                        FirstName   = ui.FirstName,
                        LastName    = ui.LastName,
                        Username    = ui.Username
                    };
                    var oEmail = new Email();
                    oEmail.SendEmail(fi.ModRejectTemplateId, PortalSettings.PortalId, _moduleId, _tabId, _forumId, _topicId, _replyId, string.Empty, au);
                }
            }

            NotificationsController.Instance.DeleteNotification(dto.NotificationId);
            return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" }));
        }
        public HttpResponseMessage RejectPost(ModerationDTO dto)
        {
            var notify = NotificationsController.Instance.GetNotification(dto.NotificationId);
            
            ParseNotificationContext(notify.Context);
            
            var fc = new ForumController();
            var fi = fc.Forums_Get(_forumId, -1, false, true);
            if (fi == null)
                return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Forum Not Found" });

            if (!(IsMod(_forumId)))
                return Request.CreateResponse(HttpStatusCode.Forbidden, new { Message = "User is not a moderator for this forum" });


            var mc = new ModController();
            mc.Mod_Reject(PortalSettings.PortalId, _moduleId, UserInfo.UserID, _forumId, _topicId, _replyId);
            
            int authorId;
            
            if (_replyId > 0)
            {
                var rc = new ReplyController();
                var reply = rc.Reply_Get(PortalSettings.PortalId, _moduleId, _topicId, _replyId);

                if (reply == null)
                    return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Reply Not Found" });

                authorId = reply.Content.AuthorId;
            }
            else
            {
                var tc = new TopicsController();
                var topic = tc.Topics_Get(PortalSettings.PortalId, _moduleId, _topicId);
                if (topic == null)
                    return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Topic Not Found" });

                authorId = topic.Content.AuthorId;
            }

            if (fi.ModRejectTemplateId > 0 && authorId > 0)
            {
                var uc = new Entities.Users.UserController();
                var ui = uc.GetUser(PortalSettings.PortalId, authorId);
                if (ui != null)
                {
                    var au = new Author
                                 {
                                     AuthorId = authorId,
                                     DisplayName = ui.DisplayName,
                                     Email = ui.Email,
                                     FirstName = ui.FirstName,
                                     LastName = ui.LastName,
                                     Username = ui.Username
                                 };
                    Email.SendEmail(fi.ModRejectTemplateId, PortalSettings.PortalId, _moduleId, _tabId, _forumId, _topicId, _replyId, string.Empty, au);
                }

            }

            NotificationsController.Instance.DeleteNotification(dto.NotificationId);
            return Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" });
        }
        public HttpResponseMessage IgnorePost(ModerationDTO dto)
        {
            var notify = NotificationsController.Instance.GetNotification(dto.NotificationId);
            ParseNotificationContext(notify.Context);
           
            var fc = new ForumController();
            var fi = fc.Forums_Get(_forumId, -1, false, true);
            if (fi == null)
                return Request.CreateResponse(HttpStatusCode.OK, new { Message = "Forum Not Found" });

            if (!(IsMod(_forumId)))
                return Request.CreateResponse(HttpStatusCode.Forbidden, new { Message = "User is not a moderator for this forum" });

            NotificationsController.Instance.DeleteNotification(dto.NotificationId);
            return Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" });
        }