Пример #1
0
        public async Task <IActionResult> GetAssets(string app, [FromQuery] string ids = null)
        {
            var context = Context();

            var assets = await assetQuery.QueryAsync(context, Q.Empty.WithODataQuery(Request.QueryString.ToString()).WithIds(ids));

            var response = AssetsDto.FromAssets(assets);

            if (controllerOptions.Value.EnableSurrogateKeys && response.Items.Length <= controllerOptions.Value.MaxItemsForSurrogateKeys)
            {
                Response.Headers["Surrogate-Key"] = response.Items.ToSurrogateKeys();
            }

            Response.Headers[HeaderNames.ETag] = response.Items.ToManyEtag(response.Total);

            return(Ok(response));
        }
Пример #2
0
        public async Task <IActionResult> GetAssets(string app, [FromQuery] string ids = null)
        {
            var assets = await assetQuery.QueryAsync(Context, Q.Empty.WithODataQuery(Request.QueryString.ToString()).WithIds(ids));

            var response = Deferred.Response(() =>
            {
                return(AssetsDto.FromAssets(assets, this, app));
            });

            if (controllerOptions.EnableSurrogateKeys && assets.Count <= controllerOptions.MaxItemsForSurrogateKeys)
            {
                Response.Headers["Surrogate-Key"] = assets.ToSurrogateKeys();
            }

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

            return(Ok(response));
        }