public async Task <IActionResult> SearchResources(CancellationToken cancellationToken) { var searchUMAResourceParameter = new SearchUMAResourceParameter(); EnrichSearchRequestParameter(searchUMAResourceParameter); var searchResult = await _umaResourceRepository.Find(searchUMAResourceParameter, cancellationToken); var result = new JObject { { "totalResults", searchResult.TotalResults }, { "count", searchUMAResourceParameter.Count }, { "startIndex", searchUMAResourceParameter.StartIndex }, { "data", new JArray(searchResult.Records.Select(rec => ResourcesAPIController.Serialize(rec))) } }; return(new OkObjectResult(result)); }
private async Task <IActionResult> InternalSearch(CancellationToken cancellationToken, string subject = null) { var searchUMAResourceParameter = new SearchUMAResourceParameter(); EnrichSearchRequestParameter(searchUMAResourceParameter); searchUMAResourceParameter.Subject = subject; var searchResult = await _umaResourceRepository.Find(searchUMAResourceParameter, cancellationToken); var result = new JObject { { "totalResults", searchResult.TotalResults }, { "count", searchUMAResourceParameter.Count }, { "startIndex", searchUMAResourceParameter.StartIndex }, { "data", new JArray(searchResult.Records.Select(rec => Serialize(rec))) } }; return(new OkObjectResult(result)); }