public async Task <IActionResult> GetAthletesByMeetAsync( int meetId, [FromQuery] PagingOptions pagingOptions, [FromQuery] SortOptions <Athlete, AthleteEntity> sortOptions, [FromQuery] SearchOptions <Athlete, AthleteEntity> searchOptions, CancellationToken ct) { if (!ModelState.IsValid) { return(BadRequest(new ApiError(ModelState))); } pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset; pagingOptions.Limit = pagingOptions.Limit ?? _defaultPagingOptions.Limit; var athletes = await _athleteService.GetAthletesByMeetAsync( meetId, pagingOptions, sortOptions, searchOptions, ct); var collection = PagedCollection <Athlete> .Create <AthletesResponse>( Link.ToCollection(nameof(GetAthletesByMeetAsync)), athletes.Items.ToArray(), athletes.TotalSize, pagingOptions); collection.AthletesQuery = FormMetadata.FromResource <Athlete>( Link.ToForm(nameof(GetAthletesByMeetAsync), null, Link.GetMethod, Form.QueryRelation)); return(Ok(collection)); }