Пример #1
0
        public void Delete(string id)
        {
            TagsElement tags   = null;
            var         tagsId = new CustomTagsId(id);

            Site site = tagsId.SiteId == null ? null : SiteHelper.GetSite(tagsId.SiteId.Value);

            if (tagsId.SiteId == null || site != null)
            {
                tags = OutboundRulesHelper.GetSection(site, tagsId.Path).Tags.FirstOrDefault(t => t.Name.Equals(tagsId.Name, StringComparison.OrdinalIgnoreCase));
            }

            if (tags != null)
            {
                var section = OutboundRulesHelper.GetSection(site, tagsId.Path, ManagementUnit.ResolveConfigScope());

                OutboundRulesHelper.DeleteCustomTags(tags, section);
                ManagementUnit.Current.Commit();
            }

            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
        }