public async Task <IActionResult> GetUsers([FromQuery] string?query = null, [FromQuery] int skip = 0, [FromQuery] int take = 10) { var users = await userService.QueryAsync(query, take, skip); var response = UsersDto.FromResults(users, users.Total, Resources); return(Ok(response)); }
public async Task <IActionResult> GetUsers([FromQuery] string?query = null, [FromQuery] int skip = 0, [FromQuery] int take = 10) { var(items, total) = await AsyncHelper.WhenAll( userManager.QueryByEmailAsync(query, take, skip), userManager.CountByEmailAsync(query)); var response = UsersDto.FromResults(items, total, Resources); return(Ok(response)); }
public async Task <IActionResult> GetUsers([FromQuery] string query = null, [FromQuery] int skip = 0, [FromQuery] int take = 10) { var taskForItems = userManager.QueryByEmailAsync(query, take, skip); var taskForCount = userManager.CountByEmailAsync(query); await Task.WhenAll(taskForItems, taskForCount); var response = UsersDto.FromResults(taskForItems.Result, taskForCount.Result, this); return(Ok(response)); }