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

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

                return(Ok(user.WatcmanId));
            }
            return(BadRequest(model));
        }
Esempio n. 2
0
        public async Task <IActionResult> CreateWatchmanProfile()
        {
            var token = this.GetAccessTokenFromCookies();
            var email = this.GetUserEmailFromHttpContext();

            var          user        = _userManager.FindByEmailAsync(email, token).Result;
            WatchmanInfo newWatchman = new WatchmanInfo()
            {
                Id = Guid.NewGuid()
            };

            await _watchmanPatientService.CreateWatchmanAsync(newWatchman, token);

            await _userHealthService.AddWatchmanToUserAsync(user.Id, newWatchman.Id, token);

            return(RedirectToAction("WatchmanProfile"));
        }