Exemple #1
0
        public async Task <LocalizeConfigData> GetItemAsync()
        {
            LocalizeConfigData config = await DataProvider.GetAsync(KEY);

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