Exemple #1
0
        public IActionResult PatientLookUp(PatientLookupViewModel patientLookupViewModel)
        {
            ViewBag.DoctorName = HttpContext.Session.GetString(Globals.currentUserName);
            if (!ModelState.IsValid)
            {
                return(View(patientLookupViewModel));
            }
            Assets <PatientCredAssetData> userAsset = _bigChainDbService.GetPatientAssetFromID(patientLookupViewModel.PHN);

            if (userAsset == null)
            {
                var sugg_phn = _bigChainDbService.GetSuggPatientPHN(patientLookupViewModel.PHN);
                ModelState.AddModelError("", "We could not find a matching user.");
                if (sugg_phn != "")
                {
                    ModelState.AddModelError("", "Did you mean: " + sugg_phn + "?");
                }

                return(View(patientLookupViewModel));
            }
            HttpContext.Session.SetString(Globals.currentPSPubK, userAsset.data.Data.SignPublicKey);
            HttpContext.Session.SetString(Globals.currentPAPubK, userAsset.data.Data.AgreePublicKey);
            HttpContext.Session.SetString(Globals.currentPPHN, userAsset.data.Data.ID);
            return(RedirectToAction("PatientOverview"));
        }