示例#1
0
        public AjaxResponse DoEditTagName(int id, string name)
        {
            AjaxResponse resp = new AjaxResponse();

            resp.rs3 = id.ToString();
            resp.rs4 = HttpUtility.HtmlEncode(name);

            var tag = ForumDataProvider.GetTagByID(TenantProvider.CurrentTenantID, id);

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

            tag.Name = name;

            try
            {
                ForumDataProvider.UpdateTag(TenantProvider.CurrentTenantID, tag.ID, tag.Name, tag.IsApproved);
                resp.rs1 = "1";
            }
            catch (Exception e)
            {
                resp.rs1 = "0";
                resp.rs2 = e.Message.HtmlEncode();
            }

            return(resp);
        }