コード例 #1
0
        public async Task <AuditConfigData> GetItemAsync()
        {
            AuditConfigData config = await DataProvider.GetAsync(KEY);

            if (config == null)
            {
                config = new AuditConfigData();
                await AddConfigAsync(config);
            }
            return(config);
        }
コード例 #2
0
 private async Task AddConfigAsync(AuditConfigData data)
 {
     data.Id = KEY;
     if (!await DataProvider.AddAsync(data))
     {
         throw new InternalError("Unexpected error adding settings");
     }
     await Auditing.AddAuditAsync($"{nameof(AuditConfigDataProvider)}.{nameof(AddConfigAsync)}", "Config", Guid.Empty,
                                  "Add Audit Config",
                                  DataBefore : null,
                                  DataAfter : data,
                                  ExpensiveMultiInstance : true
                                  );
 }
コード例 #3
0
        public async Task UpdateConfigAsync(AuditConfigData data)
        {
            AuditConfigData 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(AuditConfigDataProvider)}.{nameof(UpdateConfigAsync)}", "Config", Guid.Empty,
                                         "Update Audit Config",
                                         DataBefore : origConfig,
                                         DataAfter : data,
                                         ExpensiveMultiInstance : true
                                         );
        }