コード例 #1
0
        public object Patch(string id, [FromBody] dynamic model)
        {
            if (model == null)
            {
                throw new ApiArgumentException("model");
            }

            var outboundRulesId = new RewriteId(id);

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

            if (outboundRulesId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model);

            OutboundRulesHelper.UpdateSection(model, site, outboundRulesId.Path, configPath);

            ManagementUnit.Current.Commit();

            return(OutboundRulesHelper.SectionToJsonModel(site, outboundRulesId.Path));
        }