コード例 #1
0
        public async Task <ActionResult> LoginAsync(LoginViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // Get new Practitioner from input Id
            Practitioner newPractitioner;

            newPractitioner = await FhirService.GetPractitioner(model.Id);

            if (newPractitioner != null)
            {
                AppContext.Practitioner    = newPractitioner;
                AppContext.MonitorPatients = new PatientsList();

                // Notify observers of Practitioner
                AppContext.Practitioner.Notify();
                return(Redirect("/Practitioner/"));
            }
            else
            {
                TempData["ErrorMessage"] = "Practitioner Not Found. Please try again!";
                return(View("Login"));
            }
        }