Пример #1
0
        public IHttpActionResult Get(ODataQueryOptions <V1FeedPackage> options)
        {
            if (!_featureFlagService.IsODataV1GetAllEnabled())
            {
                return(BadRequest(Strings.ODataDisabled));
            }

            if (!ODataQueryVerifier.AreODataOptionsAllowed(options, ODataQueryVerifier.V1Packages,
                                                           _configurationService.Current.IsODataFilterEnabled, nameof(Get)))
            {
                return(BadRequest(ODataQueryVerifier.GetValidationFailedMessage(options)));
            }

            bool result = TryShouldIgnoreOrderById(options, out var shouldIgnoreOrderById);

            if (!result)
            {
                return(BadRequest("Invalid OrderBy parameter"));
            }

            var queryable = GetAll()
                            .Where(p => !p.IsPrerelease && p.PackageStatusKey == PackageStatus.Available)
                            .Where(SemVerLevelKey.IsUnknownPredicate())
                            .WithoutSortOnColumn(Version)
                            .WithoutSortOnColumn(Id, shouldIgnoreOrderById)
                            .ToV1FeedPackageQuery(_configurationService.GetSiteRoot(UseHttps()));

            return(TrackedQueryResult(options, queryable, MaxPageSize, customQuery: true));
        }
Пример #2
0
 public IHttpActionResult Get(ODataQueryOptions <V1FeedPackage> options)
 {
     return(Get(options, _featureFlagService.IsODataV1GetAllEnabled()));
 }