示例#1
0
        public Task <SearchResourceSetResult> Execute(SearchResourceSetParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            return(_resourceSetRepository.Search(parameter));
        }
示例#2
0
        public Task <SearchResourceSetResult> Execute(SearchCurrentUserResourceSetParameter searchCurrentUserResourceSetParameter)
        {
            if (searchCurrentUserResourceSetParameter == null)
            {
                throw new ArgumentNullException(nameof(searchCurrentUserResourceSetParameter));
            }

            var parameter = new SearchResourceSetParameter
            {
                Owners     = new[] { searchCurrentUserResourceSetParameter.Owner },
                StartIndex = searchCurrentUserResourceSetParameter.StartIndex,
                Count      = searchCurrentUserResourceSetParameter.Count
            };

            return(_resourceSetRepository.Search(parameter));
        }
        public Task <SearchResourceSetResult> Execute(SearchSharedResourcesParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }


            return(_resourceSetRepository.Search(new SearchResourceSetParameter
            {
                Subjects = new List <string>
                {
                    parameter.Subject
                },
                Count = parameter.Count,
                StartIndex = parameter.StartIndex
            }));
        }
示例#4
0
        public async Task <ActionResult <PagedResult <ResourceSet> > > SearchResourceSets(
            [FromBody] SearchResourceSet?searchResourceSet,
            CancellationToken cancellationToken)
        {
            if (searchResourceSet == null)
            {
                return(BuildError(
                           ErrorCodes.InvalidRequest,
                           Strings.NoParameterInBodyRequest,
                           HttpStatusCode.BadRequest));
            }

            var result = await _resourceSetRepository.Search(searchResourceSet, cancellationToken)
                         .ConfigureAwait(false);

            return(new OkObjectResult(
                       new PagedResult <ResourceSet>
            {
                Content = result.Content,
                StartIndex = result.StartIndex,
                TotalResults = result.TotalResults
            }));
        }