示例#1
0
        public async Task <IActionResult> ReadProfile([FromRoute] string username)
        {
            var result = await this.mediator.Send(new ReadProfile(username));

            var profile = new ReadProfileResponse
            {
                UserId      = result.UserId,
                Username    = result.Username,
                DisplayName = result.DisplayName,
                Bio         = result.Bio,
                ImageUrl    = result.ImageUrl,
            };

            return(this.Ok(profile));
        }
示例#2
0
        public async Task <IActionResult> ReadProfileOwn()
        {
            var userId = Guid.Parse(this.User.Claims.First(x => x.Type == "sub").Value);
            var result = await this.mediator.Send(new ReadProfile(userId));

            var profile = new ReadProfileResponse
            {
                UserId      = result.UserId,
                Username    = result.Username,
                DisplayName = result.DisplayName,
                Bio         = result.Bio,
                ImageUrl    = result.ImageUrl,
            };

            return(this.Ok(profile));
        }