예제 #1
0
        public IActionResult GetBookForAuthor(Guid authorId, Guid id, [FromHeader(Name = "Accept")] string mediaType)
        {
            if (!_authorAppService.AuthorExists(authorId))
            {
                return(NotFound());
            }

            var bookForAuthor = _bookAppService.GetBookForAuthor(authorId, id);

            if (bookForAuthor == null)
            {
                return(NotFound());
            }

            if (mediaType == "application/vnd.tmaturano.hateoas+json")
            {
                return(Ok(CreateLinksForBook(bookForAuthor)));
            }
            else
            {
                return(Ok(bookForAuthor));
            }
        }