public async void ReplaceAddr(InputAddr addr) { try { var res = await this.inContainer.ReplaceItemAsync <InputAddr>( partitionKey : new PartitionKey(addr.docType), id : addr.id, item : addr); //var res = await this.gcContainer.UpsertItemAsync(partitionKey: new PartitionKey(addr.docType), item: addr); InputAddr updated = res.Resource; } catch (Exception) { throw; } }
public async Task <SearchFuzzyResponse> FuzzySearch(InputAddr addr) { string query = $"{addr.CustomerAddress} {addr.CustomerCity} {addr.State} {addr.Zip}"; string myUrl = $"{_settings.FuzzyBaseUrl}api-version=1.0&subscription-key={_settings.ApiKey}&limit=20&lat={addr.Lat}&lon={addr.Lon}&idxSet=POI&radius=200&query={query}"; var client = _clientFactory.CreateClient(); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); try { var streamTask = client.GetStreamAsync(myUrl); var res = await JsonSerializer.DeserializeAsync <SearchFuzzyResponse>(await streamTask); return(res); } catch (Exception) { throw; } }