public bool DistanceIsOk(DriverLocationModel dr, ClientRequestModel cr) { var distance = 100D; var isLat1 = double.TryParse(dr.Latitude, out var lat1); var isLng1 = double.TryParse(dr.Longitude, out var lng1); var isLat2 = double.TryParse(cr.Latitude, out var lat2); var isLng2 = double.TryParse(cr.Longitude, out var lng2); if (isLat1 && isLng1 && isLat2 && isLng2) { distance = FuncHelper.Distance(lat1, lng1, lat2, lng2, 2); } if (distance > 5D) { return(false); } return(true); }