public async Task <IActionResult> CreateAsync([FromBody] UserRequestDto createDto) { var user = await _addUserService.AddAsync(createDto.ToUser()); var created = UserResponseDto.FromUser(user); return(Created($"{_siteSettings.ListenUri}/users/{user.UserId}", created)); }
public async Task <IActionResult> UpdateAsync([FromRoute] Guid userId, [FromBody] UserRequestDto dto) { User user; if (this.UserHasScope(UserScopes.Admin) || userId == this.GetUserId()) { user = await _updateUserService.UpdateAsync(dto.ToUser(userId)); } else { throw new ForbiddenException(); } var updated = UserResponseDto.FromUser(user); return(Ok(updated)); }