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