public async Task <IEnumerable <AddressSearchResult> > SearchByPostcodeAsync(string postcode) { var propertySearch = new FWTPropertySearch { Postcode = postcode }; return(await DoPropertySearch(propertySearch)); }
private async Task <IEnumerable <AddressSearchResult> > DoPropertySearch(FWTPropertySearch propertySearch) { var propertySearchResults = await _verintConnection.searchForPropertyAsync(propertySearch); var addressResults = propertySearchResults.FWTObjectBriefDetailsList.Select(result => new AddressSearchResult { UniqueId = result.ObjectID.ObjectReference[0], Name = result.ObjectDescription }); return(addressResults); }
public async Task <IEnumerable <StockportGovUK.NetStandard.Models.Verint.Address> > GetPropertiesAsync(string propertySearch) { var fWTPropertySearch = new FWTPropertySearch { Postcode = propertySearch }; var propertySearchResults = await _verintConnection.searchForPropertyAsync(fWTPropertySearch); var addressResults = propertySearchResults.FWTObjectBriefDetailsList.Select(result => new AddressSearchResult { UniqueId = result.ObjectID.ObjectReference[0], Name = result.ObjectDescription }); var addressList = new List <StockportGovUK.NetStandard.Models.Verint.Address>(); foreach (var address in addressResults) { var fWTObjectID = new FWTObjectID { ObjectReference = new[] { address.UniqueId }, ObjectType = VerintConstants.PropertyObjectType }; var result = await _verintConnection.retrievePropertyAsync(fWTObjectID); addressList.Add(new StockportGovUK.NetStandard.Models.Verint.Address { UPRN = result.FWTProperty.UPRN?.Trim(), Description = address.Name?.Trim(), AddressLine1 = result.FWTProperty.AddressLine1?.Trim(), AddressLine2 = result.FWTProperty.AddressLine2?.Trim(), City = result.FWTProperty.City?.Trim(), Postcode = result.FWTProperty.Postcode?.Trim(), Number = result.FWTProperty.AddressNumber?.Trim(), USRN = result.FWTProperty.USRN?.Trim(), Easting = result.FWTProperty.GPSItmGeoCode?.Trim(), Northing = result.FWTProperty.GPSUtmGeoCode?.Trim() }); } return(addressList); }
public async Task <StockportGovUK.NetStandard.Models.Verint.Address> GetPropertyByUprnAsync(string uprn) { var fwtPropertySearch = new FWTPropertySearch { UPRN = uprn }; var propertySearchResults = await _verintConnection.searchForPropertyAsync(fwtPropertySearch); if (propertySearchResults == null || !propertySearchResults.FWTObjectBriefDetailsList.Any()) { return(null); } var fWTObjectID = new FWTObjectID { ObjectReference = new[] { propertySearchResults.FWTObjectBriefDetailsList.FirstOrDefault().ObjectID.ObjectReference[0] }, ObjectType = VerintConstants.PropertyObjectType }; var result = await _verintConnection.retrievePropertyAsync(fWTObjectID); var address = new StockportGovUK.NetStandard.Models.Verint.Address { UPRN = result.FWTProperty.UPRN?.Trim(), Description = propertySearchResults.FWTObjectBriefDetailsList.FirstOrDefault().ObjectDescription?.Trim(), AddressLine1 = result.FWTProperty.AddressLine1?.Trim(), AddressLine2 = result.FWTProperty.AddressLine2?.Trim(), City = result.FWTProperty.City?.Trim(), Postcode = result.FWTProperty.Postcode?.Trim(), Number = result.FWTProperty.AddressNumber?.Trim(), USRN = result.FWTProperty.USRN?.Trim(), Easting = result.FWTProperty.GPSItmGeoCode?.Trim(), Northing = result.FWTProperty.GPSUtmGeoCode?.Trim() }; return(address); }