/// <summary> /// Hello. /// </summary> /// <param name="aText">Text.</param> /// <param name="aTranslations">Translations.</param> /// <returns>Task.</returns> private async Task PersistAsync(string aText, IReadOnlyDictionary <string, string> aTranslations) { try { TranscriptionEntity lItem = this.GetCurrentTranscriptionEntity(); lItem.When = DateTime.UtcNow; lItem.Text = aText; if (aTranslations != null) { foreach (var lItemTrans in aTranslations) { lItem.Translations = lItemTrans.Value; } } var lPayload = new StringContent(JsonConvert.SerializeObject(lItem), Encoding.UTF8, "application/json"); await this.mHttpClient.PostAsync(this.mFunctionsEndPoint, lPayload).ConfigureAwait(false); } catch (Exception ex) { _eventPublisher.Publish("PersistAsync", $"Erro: {ex.Message}"); } }
/// <summary> /// Hello. /// </summary> /// <returns>hey.</returns> private TranscriptionEntity GetCurrentTranscriptionEntity() { if (this.mCurrentTranscriptionObject == null) { this.mCurrentTranscriptionObject = new TranscriptionEntity(); this.mCurrentTranscriptionObject.Id = Guid.NewGuid().ToString(); this.mCurrentTranscriptionObject.CallId = this.mCallId; this.mCurrentTranscriptionObject.Who = this.mWho; this.mCurrentTranscriptionObject.WhoId = this.mWhoId; } return(this.mCurrentTranscriptionObject); }
/// <summary> /// Hello. /// </summary> private void ResetCurrentTranscriptionEntity() { this.mCurrentTranscriptionObject = null; }