public WatchmanPage()
 {
     InitializeComponent();
     BindingContext = new WatchmanViewModel()
     {
         Patients = new ObservableCollection <PersonalInfo>()
         {
             new PersonalInfo()
             {
                 FirstName  = "Alan",
                 SecondName = "Moore"
             }
         }
     };
 }
Exemple #2
0
        public async Task <IActionResult> WatchmanProfile()
        {
            string stringId = User.FindFirstValue("watchmanIdClaim");

            if (String.IsNullOrWhiteSpace(stringId))
            {
                return(RedirectToAction("RefreshToken", "Account", new { returnUrl = Request.Path.Value }));
            }

            var token = this.GetAccessTokenFromCookies();
            var id    = Guid.Parse(stringId);

            var watchman = await _watchmanPatientService.GetWatchmanAsync(id, token);

            var model = new WatchmanViewModel()
            {
                WatchmanId = watchman.Id
            };

            if (!watchman.WatchmanPatients.Any())
            {
                return(View(model));
            }

            IList <PatientProfileAndPersonalInfoPair> patients = new List <PatientProfileAndPersonalInfoPair>();

            foreach (var pair in watchman.WatchmanPatients)
            {
                patients.Add(new PatientProfileAndPersonalInfoPair()
                {
                    Patient             = await _watchmanPatientService.GetPatientAsync(pair.PatientId, token),
                    PersonalInformation = await
                                          _personalService.GetPersonalInformation(
                        (await _userManager.FindByPatient(pair.PatientId, token)).PersonalInformationId
                        , token)
                });
            }

            model.PatientsAndPersonalInfoPairs = patients;
            return(View(model));
        }