/// <summary> /// Handle Get More Data event in View /// </summary> /// <returns> Index View </returns> public async Task <ActionResult> GetData() { // execute async task with callback to avoid blocking the web app _ = FhirService.GetData().ContinueWith((data) => { // Write fetched data to csv file MLHelpers.WriteToCsv(data.Result); // Save new fetched data to AppContext foreach (Patient p in data.Result) { AppContext.AnalysisData.AddPatient(p); } }); return(View("Index")); }