public async Task <bool> RemoveItemByIdentityAsync(int id) { VoiceMailData origData = Auditing.Active ? await GetItemByIdentityAsync(id) : null; if (!await DataProvider.RemoveByIdentityAsync(id)) { return(false); } await SetupClient(); try { if (YetaWFManager.IsSync()) { RecordingResource.Delete(pathSid: origData.RecordingSid); } else { await RecordingResource.DeleteAsync(pathSid : origData.RecordingSid); } } catch (Exception) { } await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(RemoveItemByIdentityAsync)}", Dataset, Guid.Empty, $"Remove Voice Mail Entry {id}", DataBefore : origData, DataAfter : null ); return(true); }
public async Task <bool> AddItemAsync(VoiceMailData data) { data.Created = DateTime.UtcNow; if (!await DataProvider.AddAsync(data)) { return(false); } await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(AddItemAsync)}", Dataset, Guid.Empty, $"Add Voice Mail Entry {data.Id}", DataBefore : null, DataAfter : data ); return(true); }
public async Task UpdateItemAsync(VoiceMailData data) { VoiceMailData origEmail = Auditing.Active ? await GetItemAsync(data.CallSid) : null; UpdateStatusEnum status = await DataProvider.UpdateByIdentityAsync(data.Id, data); if (status != UpdateStatusEnum.OK) { throw new InternalError("Unexpected error {0} updating item", status); } await Auditing.AddAuditAsync($"{nameof(VoiceMailDataProvider)}.{nameof(UpdateItemAsync)}", Dataset, Guid.Empty, $"Update Voice Mail Entry {data.Id}", DataBefore : origEmail, DataAfter : data ); }