public async Task <bool> DoesCustomerResourceExist(Guid customerId) { var documentUri = DocumentDBHelper.CreateCustomerDocumentUri(customerId); var client = DocumentDBClient.CreateDocumentClient(); if (client == null) { return(false); } try { var response = await client.ReadDocumentAsync(documentUri); if (response.Resource != null) { return(true); } } catch (DocumentClientException) { return(false); } return(false); }
public async Task <bool> DoesCustomerHaveATerminationDate(Guid customerId) { var documentUri = DocumentDBHelper.CreateCustomerDocumentUri(customerId); var client = DocumentDBClient.CreateDocumentClient(); if (client == null) { return(false); } try { var response = await client.ReadDocumentAsync(documentUri); var dateOfTermination = response.Resource?.GetPropertyValue <DateTime?>("DateOfTermination"); return(dateOfTermination.HasValue); } catch (DocumentClientException) { return(false); } }