public async Task <IActionResult> Account()
        {
            var infoId = Guid.Parse(User.FindFirstValue("infoIdClaim"));
            var token  = Request.Cookies[AccessTokenKey];

            var personalInfo = await _infoService.GetPersonalInformation(infoId, token);

            return(View(personalInfo));
        }
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));
        }
 public async Task <IActionResult> Get([FromBody] GuidFieldViewModel model)
 {
     return(Ok(await _infoService.GetPersonalInformation(model.Id)));
 }