public async Task <object> Post() { if (LoggingHelper.IsHttpEnabled() && LoggingHelper.IsCustomEnabled()) { throw new AlreadyExistsException(DISPLAY_NAME); } await LoggingHelper.SetFeatureEnabled(true); dynamic settings = LoggingHelper.ToJsonModel(null, null); return(Created(LoggingHelper.GetLocation(settings.id), settings)); }
public async Task Delete(string id) { LoggingId logId = new LoggingId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (logId.SiteId != null) ? SiteHelper.GetSite(logId.SiteId.Value) : null; if (site != null) { var section = LoggingHelper.GetHttpLoggingSection(site, logId.Path, ManagementUnit.ResolveConfigScope()); section.RevertToParent(); ManagementUnit.Current.Commit(); } if (logId.SiteId == null && (LoggingHelper.IsHttpEnabled() || LoggingHelper.IsCustomEnabled())) { await LoggingHelper.SetFeatureEnabled(false); } }