public static UsersEntity ToEntity(this UpdateProfileDetailsRequestDto dto, string username) { return(new UsersEntity() { Username = username, FirstName = dto.FirstName, LastName = dto.LastName, Introduction = dto.Introduction, }); }
public async Task <IActionResult> Put([FromBody] UpdateProfileDetailsRequestDto updateProfileDetailsRequestDto) { UnpackedJwt unpackJwt = this._jwtService.UnpackJwtClaimsToProfile(User.Claims.ToList()); UsersEntity usersEntity = await this._profileService.UpdateDetails(updateProfileDetailsRequestDto.ToEntity(unpackJwt.Username)); if (usersEntity == null) { this.BadRequest("Could not update user"); } string jwtToken = this._jwtService.GenerateToken(usersEntity); return(this.Ok(new { jwtToken })); }