public async Task <Unit> Handle(SetProfileCommand request, CancellationToken cancellationToken)
            {
                var userProfile = new UserProfile
                {
                    AuthorizationData = request.AuthorizationData,
                    Name = request.Data.Name,
                };
                await accountStore.SetProfile(userProfile, cancellationToken);

                var @event = mapper.Map <UserProfileChangedEvent>(userProfile);
                await mediator.Publish(@event, cancellationToken : cancellationToken);

                return(Unit.Value);
            }
예제 #2
0
        public async Task <IActionResult> SetProfile([FromBody] SetUserProfileRequest request)
        {
            var userProfile =
                await _userProfileStore.GetProfile(_userContext.SignedInUser.Id)
                ?? new UserProfile
            {
                Id = Guid.NewGuid(), UserId = _userContext.SignedInUser.Id
            };

            userProfile.Age    = request.Age;
            userProfile.Height = request.Height;
            userProfile.Weight = request.Weight;

            await _userProfileStore.SetProfile(userProfile);

            return(Ok());
        }