Esempio n. 1
0
        public async Task <IActionResult> GetRelatedTagsByIdAsync(int customerId)
        {
            var querySet = _jsonApiBuilder.BuildQuerySet(HttpContext.Request.Query);

            var pagedTags = await _tagManager.GetAllByCustomerIdAsync(customerId, querySet);

            var tagDtos  = _mapper.Map <IEnumerable <TagDto> >(pagedTags.Items, opt => opt.Items["include"] = querySet.Include);
            var included = _includedCollector.CollectIncluded(pagedTags.Items, querySet.Include);
            var links    = _jsonApiBuilder.BuildCollectionLinks(HttpContext.Request.Path, querySet, pagedTags);
            var meta     = _jsonApiBuilder.BuildCollectionMetadata(pagedTags);

            return(Ok(new ResourceResponse()
            {
                Meta = meta, Links = links, Data = tagDtos, Included = included
            }));
        }