internal FloodDataResultModel Convert_Flood_API_Data_To_Flood_Model(FloodDataResponse flood_data, FloodMapResponse flood_map) { FloodDataResultModel model = new FloodDataResultModel(); Convert_Flood_Data_To_Model_Properties(flood_data, model); Convert_Flood_Data_To_Model_Properties(flood_map, model); return(model); }
private FloodDataResultModel Convert_Flood_Data_To_Model_Properties(FloodDataResponse flood_data, FloodDataResultModel model) { var flood_data_result = flood_data.result .s_fld_haz_ar .FirstOrDefault(); if (flood_data_result != null) { model.FloodInsuranceRateMapId = flood_data_result.dfirm_id; model.FloodZone = flood_data_result.fld_zone; model.SpecialFloodHazardArea = flood_data_result.sfha_tf == "T" ? true : false; model.ZoneDescription = flood_data_result.zone_subty; } return(model); }
//Information for Flood Data API available at http://nationalflooddata.com/flood/floodapi/ //Built with Flurl //https://github.com/tmenier/Flurl //https://flurl.dev/ internal async Task <FloodDataResponse> Get_Flood_Data_By_Coordinates(double latitude, double longitude) { var url = Common.URL .WithHeader(Common.API_KEY_PARAMETER, Common.API_KEY) .AppendPathSegment(Common.FLOOD_DATA_API_PATH_SEGMENT) .SetQueryParams(new DataCoordinatesSearchModel { lat = latitude, lng = longitude }); FloodDataResponse data = await url.GetJsonAsync <FloodDataResponse>(); dynamic test_data = await url.GetJsonAsync(); string json = JsonConvert.SerializeObject(test_data); return(data); }