public AjaxResponse DoDeleteThreadCategory(int id)
        {
            var resp = new AjaxResponse
            {
                rs2 = id.ToString()
            };

            List <Thread> threads;
            var           category = ForumDataProvider.GetCategoryByID(TenantProvider.CurrentTenantID, id, out threads);

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

            try
            {
                RemoveDataHelper.RemoveThreadCategory(category);
                resp.rs1 = "1";
            }
            catch (Exception ex)
            {
                resp.rs1 = "0";
                resp.rs3 = ex.Message.HtmlEncode();
            }
            return(resp);
        }
예제 #2
0
        public ForumCategoryWrapper DeleteThreadCategory(int categoryid)
        {
            List <Thread> threads;

            var category = ForumDataProvider.GetCategoryByID(TenantProvider.CurrentTenantID, categoryid, out threads);

            if (category == null || !ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null))
            {
                throw new SecurityException(ForumResource.ErrorAccessDenied);
            }

            RemoveDataHelper.RemoveThreadCategory(category);

            return(new ForumCategoryWrapper(category, threads));
        }