/// <summary> /// Gets the districts. /// </summary> /// <param name="request">The request.</param> /// <returns>The response.</returns> private static GetDistrictServiceResponse GetDistricts(GetDistrictServiceRequest request) { ValidateGetAddressInfoRequests(request); string countryRegionId = request.Filters[AddressServiceConstants.CountryRegionId].ToString(); string stateId = string.Empty; string city = string.Empty; string countyId = string.Empty; if (request.Filters[AddressServiceConstants.StateProvinceId] != null) { stateId = request.Filters[AddressServiceConstants.StateProvinceId].ToString(); } if (request.Filters[AddressServiceConstants.CountyId] != null) { countyId = request.Filters[AddressServiceConstants.CountyId].ToString(); } if (request.Filters[AddressServiceConstants.CityComponentName] != null) { city = request.Filters[AddressServiceConstants.CityComponentName].ToString(); } var getDistrictDataRequest = new GetDistrictsDataRequest(countryRegionId, stateId, countyId, city, request.QueryResultSettings); var districtDataSet = request.RequestContext.Runtime.Execute <EntityDataServiceResponse <DistrictInfo> >(getDistrictDataRequest, request.RequestContext); return(new GetDistrictServiceResponse(districtDataSet.PagedEntityCollection)); }
private GetAddressResponse GetDistricts(GetAddressRequest request) { var serviceRequest = new GetDistrictServiceRequest(request.CountryRegionId, request.StateProvinceId, request.CountyId, request.City, request.QueryResultSettings) { QueryResultSettings = request.QueryResultSettings }; var serviceResponse = this.Context.Execute <GetDistrictServiceResponse>(serviceRequest); return(new GetAddressResponse(serviceResponse.Results)); }