Пример #1
0
        public async Task <IActionResult> GetInfo()
        {
            var userId = HttpContext.User.Claims.FirstOrDefault(r => r.Type == ClaimTypes.NameIdentifier)?.Value;
            var user   = await _userManager.GetById(userId);

            return(Ok(UserProfileRequest.Create(user)));
        }
Пример #2
0
        public async Task <IActionResult> UpdateUserInfo(UpdateUserProfileRequest profileRequest)
        {
            var userId = HttpContext.User.Claims.FirstOrDefault(r => r.Type == ClaimTypes.NameIdentifier)?.Value;
            var user   = await _userManager.GetById(userId);

            var toInsert = profileRequest.MergeToModel(user);

            await _userManager.UpdateProfileAsync(toInsert);

            return(Ok(UserProfileRequest.Create(toInsert)));
        }