public async Task <object> Post() { if (CompressionHelper.IsStaticEnabled() && CompressionHelper.IsDynamicEnabled()) { throw new AlreadyExistsException(DISPLAY_NAME); } await CompressionHelper.SetFeatureEnabled(true); dynamic compression = CompressionHelper.ToJsonModel(null, null); return(Created(CompressionHelper.GetLocation(compression.id), compression)); }
public async Task Delete(string id) { CompressionId compId = new CompressionId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (compId.SiteId != null) ? SiteHelper.GetSite(compId.SiteId.Value) : null; if (site != null) { // Http compression section is not reverted because it only allows definition in apphost CompressionHelper.GetUrlCompressionSection(site, compId.Path, ManagementUnit.ResolveConfigScope()).RevertToParent(); ManagementUnit.Current.Commit(); } if (compId.SiteId == null && (CompressionHelper.IsStaticEnabled() || CompressionHelper.IsDynamicEnabled())) { await CompressionHelper.SetFeatureEnabled(false); } }