public async Task<ActionResult> CheckVerification(Models.Medicine med) { using(var dbcontext = new ApplicationDbContext()) { var allergyIntolerance = new AllergyIntolerance(Constants.HapiFhirServerBase, userManager, authManager); var user = dbcontext.Users.FirstOrDefault(a => a.Email == this.User.Identity.Name); int patientID; if(user == null || !int.TryParse(user.FhirPatientId, out patientID)) { return new HttpStatusCodeResult(404, "Patient not found"); } if(string.IsNullOrWhiteSpace(user.FhirPatientId)) { //todo: figure out what to show if the patient has no fhir data setup return new HttpStatusCodeResult(404, "Patient does not have FHIR data"); } var medications = new List<string>() { med.Name }; med.Found = await allergyIntolerance.IsAllergicToMedications(patientID, medications); } return View(med); }