public IHttpActionResult SearchWeatherReport([FromBody] ForecastSearchRequest request) { try { // fetch the forecast var openWeatherApi = new OpenWeatherMapAPI(_apiKey); Forecast forecast = openWeatherApi.QueryForecast($"{request.CityName}"); //,{request.CountryCode} // store the results var forecastRepo = new ForecastRepository(_mongoDbPath); ObjectId?forecastId = forecastRepo.StoreForecast(forecast); // return the query result if (forecastId.HasValue) { return(Ok(forecastId.Value)); } else { return(BadRequest("Could not store results of query")); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void PostDecisionsDownloadsSearchTest() { // TODO: add unit test for the method 'PostDecisionsDownloadsSearch' ForecastSearchRequest body = null; // TODO: replace null with proper value var response = instance.PostDecisionsDownloadsSearch(body); Assert.IsInstanceOf <DecisionsFileMetadataEntityListing> (response, "response is DecisionsFileMetadataEntityListing"); }
public void Init() { instance = new ForecastSearchRequest(); }