public async Task <(RepositoryResult result, Sku info)> FindBySkuCodeAsync(string companyCode, string storeCode, string skuCode) { var collectionUri = UriFactory.CreateDocumentCollectionUri(DatabaseName, SkuCollectionName); var query = this._client.CreateDocumentQuery <Sku>(collectionUri) .Where(r => r.CompanyCode == companyCode && r.StoreCode == storeCode && r.SkuCode == skuCode) .AsDocumentQuery(); var sku = (await query.ExecuteNextAsync <Sku>()).FirstOrDefault(); return (sku == null ? (RepositoryResult.CreateNotFound($"SKU({skuCode}) is not found."), sku) : (RepositoryResult.OK, sku)); }
public async Task <(RepositoryResult result, Terminal info)> FindByBoxIdAsync(string boxId) { var collectionUri = UriFactory.CreateDocumentCollectionUri(DatabaseName, TerminalCollectionName); var query = this._client.CreateDocumentQuery <Terminal>(collectionUri) .Where(r => r.BoxId == boxId) .AsDocumentQuery(); var terminal = (await query.ExecuteNextAsync <Terminal>()).FirstOrDefault(); return (terminal == null ? (RepositoryResult.CreateNotFound($"Box({boxId}) is not found."), terminal) : (RepositoryResult.OK, terminal)); }