예제 #1
0
        public virtual async Task <IActionResult> GetSecondaryAsync(TId id, string relationshipName)
        {
            _logger.LogTrace($"Entering {nameof(GetSecondaryAsync)}('{id}', '{relationshipName}').");

            if (_getSecondary == null)
            {
                throw new RequestMethodNotAllowedException(HttpMethod.Get);
            }
            var relationship = await _getSecondary.GetSecondaryAsync(id, relationshipName);

            return(Ok(relationship));
        }
        /// <summary>
        /// Gets a single resource or multiple resources at a nested endpoint.
        /// Examples:
        /// GET /articles/1/author HTTP/1.1
        /// GET /articles/1/revisions HTTP/1.1
        /// </summary>
        public virtual async Task <IActionResult> GetSecondaryAsync(TId id, string relationshipName, CancellationToken cancellationToken)
        {
            _traceWriter.LogMethodStart(new { id, relationshipName });

            ArgumentGuard.NotNull(relationshipName, nameof(relationshipName));

            if (_getSecondary == null)
            {
                throw new RequestMethodNotAllowedException(HttpMethod.Get);
            }

            var relationship = await _getSecondary.GetSecondaryAsync(id, relationshipName, cancellationToken);

            return(Ok(relationship));
        }