Exemplo n.º 1
0
        public async Task <IActionResult> AddPatientToUser([FromBody] UserIdSecondIdViewModel model)
        {
            if (model?.UserId != Guid.Empty && model?.SecondId != Guid.Empty)
            {
                await _userHealthService.AddPatientToUserAsync(model.UserId, model.SecondId);

                var user = await _userManager.FindByIdAsync(model.UserId);

                return(Ok(user.PatientId));
            }
            return(BadRequest(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CreatePatientProfile()
        {
            var token = this.GetAccessTokenFromCookies();
            var email = this.GetUserEmailFromHttpContext();

            var         user           = _userManager.FindByEmailAsync(email, token).Result;
            PatientInfo newPatientInfo = new PatientInfo()
            {
                Id = Guid.NewGuid(),
                CurrentActivityState = new SleepActivityState(),
                CurrentHealthState   = new NormalHealthState()
            };
            await _watchmanPatientService.CreatePatientAsync(newPatientInfo, token);

            await _userHealthService.AddPatientToUserAsync(user.Id, newPatientInfo.Id, token);

            return(RedirectToAction("PatientProfile"));
        }