public async Task <LoggingConfigData> GetItemAsync() { LoggingConfigData config = await DataProvider.GetAsync(KEY); if (config == null) { config = new LoggingConfigData(); await AddConfigAsync(config); } return(config); }
private async Task AddConfigAsync(LoggingConfigData data) { data.Id = KEY; if (!await DataProvider.AddAsync(data)) { throw new InternalError("Unexpected error adding settings"); } await Auditing.AddAuditAsync($"{nameof(LoggingConfigDataProvider)}.{nameof(AddConfigAsync)}", "Config", Guid.Empty, "Add Logging Config", DataBefore : null, DataAfter : data, ExpensiveMultiInstance : true ); }
public async Task UpdateConfigAsync(LoggingConfigData data) { LoggingConfigData origConfig = Auditing.Active ? await GetItemAsync() : null; data.Id = KEY; UpdateStatusEnum status = await DataProvider.UpdateAsync(data.Id, data.Id, data); if (status != UpdateStatusEnum.OK) { throw new InternalError("Unexpected error saving configuration {0}", status); } await Auditing.AddAuditAsync($"{nameof(LoggingConfigDataProvider)}.{nameof(UpdateConfigAsync)}", "Config", Guid.Empty, "Update Logging Config", DataBefore : origConfig, DataAfter : data, ExpensiveMultiInstance : true ); }