public async Task <IHttpActionResult> GetBarsAround([FromBody] LocationRequestModel locationRequest) { try { InputDataValidator.LocationDataIsCorrect(locationRequest); } catch (ArgumentsForProvidersException e) { return(BadRequest("Invalid arguments:" + e.InvalidArguments)); } catch (HttpRequestException) { return(NotFound()); } List <BarData> result = await BarFetcher.RequestBarsAroundCoords(locationRequest); var names = result.Select(x => x.BarId).ToList(); var dbMgr = new DatabaseManager(); result = dbMgr.GetAllBarData(names); dbMgr.SaveBars(result); // Sending the results from databases causes an exception, as the virtual fields no longer exist. // If someone knows a better solution - please tell me @joklek return(Ok(BarDataToResponseModel(result))); }
public List <BarData> GetBarsAround(double latitude, double longitude, double radius) { InputDataValidator.LocationDataIsCorrect(latitude, longitude, radius); var placeList = GetBarData(latitude, longitude, radius); var barList = PlaceListToBarList(placeList); return(barList); }
public async Task <List <BarData> > GetBarsAroundAsync(double latitude, double longitude, double radius) { InputDataValidator.LocationDataIsCorrect(latitude, longitude, radius); var placeList = await GetBarDataAsync(latitude, longitude, radius); var barList = PlaceListToBarList(placeList); return(barList); }
public async Task <List <BarData> > GetBarsAroundAsync(double latitude, double longitude, double radius) { InputDataValidator.LocationDataIsCorrect(latitude, longitude, radius); var venueList = await GetBarDataAsync(latitude, longitude, radius); RemoveBannedVenues(venueList); var barList = VenueListToBarList(venueList, radius); return(barList); }
public List <BarData> GetBarsAround(double latitude, double longitude, double radius) { InputDataValidator.LocationDataIsCorrect(latitude, longitude, radius); var placeList = GetBarData(latitude, longitude); RemovePlacesOutsideRadius(placeList, radius); FetchLocations(placeList); RemoveUnneededPlaces(placeList); var barList = PlaceListToBarList(placeList); return(barList); }
public async Task <List <BarData> > GetBarsAroundAsync(double latitude, double longitude, double radius) { InputDataValidator.LocationDataIsCorrect(latitude, longitude, radius); var placeList = await GetBarDataAsync(latitude, longitude); RemovePlacesOutsideRadius(placeList, radius); await FetchLocationsAsync(placeList); RemoveUnneededPlaces(placeList); var barList = PlaceListToBarList(placeList); return(barList); }