public async Task <NasaNeoSet> GetNeoForDateAsync(DateTime neoDate) { return(await Task.Run(() => { var fileContents = new System.IO.StreamReader(@"C:\Dev\CodeMavens\Alexa\nasa-neo\sample-data\multi-sample-2018-03-23-to-2018-03-25.json").ReadToEnd(); //var neoData = JsonConvert.DeserializeObject<object>(fileContents.ReadToEnd()); var result = NasaApiHelper.ProcessNeoFromJson(fileContents, neoDate); return result; })); }
public async Task <NasaNeoSet> GetNeoForDateAsync(DateTime neoDate) { var result = new NasaNeoSet(); var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Accept.Clear(); var stringTask = httpClient.GetStringAsync( nasaNeoUrl .Replace("{start-date}", neoDate.ToString("yyyy-MM-dd")) .Replace("{end-date}", neoDate.ToString("yyyy-MM-dd")) .Replace("{key}", nasaApiKey)); var json = await stringTask; return(NasaApiHelper.ProcessNeoFromJson(json, neoDate)); }