DocSas/PropertyService.Domain/ModelView/Secures/MiscProvider.cs
/// <summary>
/// look up zip as an asynchronous operation.
/// </summary>
/// <param name="code">The code.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
look up zip as an asynchronous operation.
look up zip as an asynchronous operation .
public async Task<DSCResponse> LookUpZipAsync(string code)
        {
            var responseCode = await GetZipCodeByCodeAsync(code);
            if (responseCode.ResponseData == null)
            {
                var url = await _settingProvider.GetSetting(SettingKey.ZipCodeApi);
                if (!string.IsNullOrWhiteSpace(url))
                {
                    url = string.Format(url, code.Trim());
                    var result = await Utility.HttpGetItemAsync(url);
                    if (!string.IsNullOrWhiteSpace(result))
                    {
                        var data = Utility.FromJson<zipData>(result);
                        if (data != null)
                        {
                            var zipCodeEntity = new ZipCode()
                            {
                                Code = data.zip_code,
                                Longitude = data.lng,
                                Latitude = data.lat,
                                City = data.city,
                                Province = data.state
                            };
                            responseCode.ResponseData = zipCodeEntity;
                        }
                    }
                }
            }
            return responseCode;
        }
public async Task < DSCResponse > LookUpZipAsync ( string code ) { var responseCode = await GetZipCodeByCodeAsync ( code ) ; if ( responseCode . ResponseData == null ) { var url = await _settingProvider . GetSetting ( SettingKey . ZipCodeApi ) ; if ( ! string . IsNullOrWhiteSpace ( url ) ) { url = string . Format ( url , code . Trim ( ) ) ; var result = await Utility . HttpGetItemAsync ( url ) ; if ( ! string . IsNullOrWhiteSpace ( result ) ) { var data = Utility . FromJson < zipData > ( result ) ; if ( data != null ) { var zipCodeEntity = new ZipCode ( ) { Code = data . zip_code , Longitude = data . lng , Latitude = data . lat , City = data . city , Province = data . state } ; responseCode . ResponseData = zipCodeEntity ; } } } } return responseCode ; }
look up zip as an asynchronous operation.
look up zip as an asynchronous operation .
None
code
string
None