Beispiel #1
0
        public async Task <IHttpActionResult> GetFamilies(ODataQueryOptions <Family> queryOptions)
        {
            // validate the query.
            var exception = ValidateQuery(queryOptions);

            if (exception != null)
            {
                return(BadRequest(exception.Message));
            }
            var translator = new DocDBQueryGenerator();
            var query      = translator.TranslateToDocDBQuery(queryOptions);

            var skiptoken = queryOptions.RawValues.SkipToken;
            var filter    = queryOptions.RawValues.Filter;
            var res       = await DocDbRepository.DocDbRepository.QueryWithPagingAsyncTypeless(query, skiptoken);

            var response = Ok <IEnumerable <Family> >(res.Item1);

            if (res.Item2 != null)
            {
                response.Request.ODataProperties().NextLink =
                    GenerateNextLinkURL(queryOptions.Request.RequestUri, filter, res.Item2);
            }
            return(response);
        }
        public async Task <IHttpActionResult> GetFamilyForTests(ODataQueryOptions <FamilyForTest> queryOptions)
        {
            // validate the query.
            var exception = ValidateQuery(queryOptions);

            if (exception != null)
            {
                return(BadRequest(exception.Message));
            }
            var translator = new DocDBQueryGenerator();
            var query      = translator.TranslateToDocDBQuery(queryOptions);

            return(Ok <string>(query));
        }