public async void OnSelectedDocumentChanged() { if (SelectedDocument != null) { IsRunning = true; if (_currentDocument?.Resource.SelfLink != SelectedDocument.SelfLink) { try { _currentDocument = await _dbService.GetDocumentAsync(Node.Parent.Parent.Parent.Connection, SelectedDocument).ConfigureAwait(false); } catch (DocumentClientException clientEx) { await _dialogService.ShowError(clientEx.Parse(), "Error", null, null).ConfigureAwait(false); } catch (Exception ex) { await _dialogService.ShowError(ex, "Error", "ok", null).ConfigureAwait(false); } } SetStatusBar(new StatusBarInfo(_currentDocument)); IsRunning = false; } else { SetStatusBar(null); } }
public virtual async Task <T> GetDocumentAsync <T>(string documentId) where T : AuditedDocumentBase, new() { var partitionKey = GetPartitionKey(); var document = await _documentDbService.GetDocumentAsync <T>(_collectionId, partitionKey, documentId); if (document == null) { throw new DocumentNotFoundException(); } else if (document.IsDeleted) { throw new DocumentAlreadyDeletedException(); } return(document); }
public virtual async Task <T> GetEventAsync <T>(string documentId, string partitionKey) where T : EventDocumentBase, new() { var document = await _documentDbService.GetDocumentAsync <T>(_collectionId, partitionKey, documentId); if (document == null) { throw new DocumentNotFoundException(); } return(document); }