Example #1
0
        public AjaxResponse DoDeleteThread(int threadID, int categoryID)
        {
            AjaxResponse resp = new AjaxResponse();

            resp.rs2 = threadID.ToString();
            resp.rs3 = categoryID.ToString();

            var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, threadID);

            if (thread == null ||
                !ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null))
            {
                resp.rs1 = "0";
                resp.rs4 = Resources.ForumResource.ErrorAccessDenied;
                return(resp);
            }

            try
            {
                var removedPostIDs = new List <int>();
                ForumDataProvider.RemoveThread(TenantProvider.CurrentTenantID, thread.ID, out removedPostIDs);

                ForumActivityPublisher.DeleteThread(thread);

                ForumManager.Instance.RemoveAttachments(thread);

                removedPostIDs.ForEach(idPost => CommonControlsConfigurer.FCKUploadsRemoveForItem(ForumManager.Settings.FileStoreModuleID, idPost.ToString()));


                resp.rs1 = "1";
            }
            catch (Exception ex)
            {
                resp.rs1 = "0";
                resp.rs4 = ex.Message.HtmlEncode();
            }
            return(resp);
        }