Esempio n. 1
0
        public async Task <IActionResult> GetContentsPost(string app, string name, [FromBody] QueryDto query)
        {
            var schema = await contentQuery.GetSchemaOrThrowAsync(Context, name);

            var contents = await contentQuery.QueryAsync(Context, name, query?.ToQuery() ?? Q.Empty);

            var response = Deferred.AsyncResponse(async() =>
            {
                return(await ContentsDto.FromContentsAsync(contents, Context, this, schema, contentWorkflow));
            });

            return(Ok(response));
        }
Esempio n. 2
0
        public async Task <IActionResult> GetContents(string app, string name, [FromQuery] string?ids = null, [FromQuery] string?q = null)
        {
            var schema = await contentQuery.GetSchemaOrThrowAsync(Context, name);

            var contents = await contentQuery.QueryAsync(Context, name, CreateQuery(ids, q));

            var response = Deferred.AsyncResponse(async() =>
            {
                return(await ContentsDto.FromContentsAsync(contents, Context, this, schema, contentWorkflow));
            });

            return(Ok(response));
        }
Esempio n. 3
0
        public async Task <IActionResult> GetContents(string app, string name, [FromQuery] string?ids = null, [FromQuery] string?q = null)
        {
            var schema = await contentQuery.GetSchemaOrThrowAsync(Context, name);

            var contents = await contentQuery.QueryAsync(Context, name,
                                                         Q.Empty
                                                         .WithIds(ids)
                                                         .WithJsonQuery(q)
                                                         .WithODataQuery(Request.QueryString.ToString()));

            var response = Deferred.AsyncResponse(async() =>
            {
                return(await ContentsDto.FromContentsAsync(contents, Context, this, schema, contentWorkflow));
            });

            return(Ok(response));
        }
Esempio n. 4
0
        public async Task <IActionResult> GetAllContents(string app, [FromQuery] string ids)
        {
            var contents = await contentQuery.QueryAsync(Context, Q.Empty.WithIds(ids).Ids);

            var response = Deferred.AsyncResponse(() =>
            {
                return(ContentsDto.FromContentsAsync(contents, Context, this, null, contentWorkflow));
            });

            if (ShouldProvideSurrogateKeys(contents))
            {
                Response.Headers["Surrogate-Key"] = contents.ToSurrogateKeys();
            }

            Response.Headers[HeaderNames.ETag] = contents.ToEtag();

            return(Ok(response));
        }
Esempio n. 5
0
        public async Task <IActionResult> GetContents(string app, string name, [FromQuery] string ids = null)
        {
            var schema = await contentQuery.GetSchemaOrThrowAsync(Context, name);

            var contents = await contentQuery.QueryAsync(Context, name, Q.Empty.WithIds(ids).WithODataQuery(Request.QueryString.ToString()));

            var response = Deferred.AsyncResponse(async() =>
            {
                return(await ContentsDto.FromContentsAsync(contents, Context, this, schema, contentWorkflow));
            });

            if (ShouldProvideSurrogateKeys(contents))
            {
                Response.Headers["Surrogate-Key"] = contents.ToSurrogateKeys();
            }

            Response.Headers[HeaderNames.ETag] = contents.ToEtag();

            return(Ok(response));
        }