public IActionResult GetBooksForAuthor(Guid authorId, [FromHeader(Name = "Accept")] string mediaType) { if (!_authorAppService.AuthorExists(authorId)) { return(NotFound()); } var booksForAuthor = _bookAppService.GetBooksByAuthorId(authorId); if (mediaType == "application/vnd.tmaturano.hateoas+json") { //HATEOAS we need to create a link for each group booksForAuthor = booksForAuthor.Select(book => { book = CreateLinksForBook(book); return(book); }); var wrapper = new LinkedCollectionResourceWrapperDto <BookOutputDto>(booksForAuthor); return(Ok(CreateLinksForBooks(wrapper))); } else { return(Ok(booksForAuthor)); } }