public IActionResult BlockAuthorCreation(Guid id) { if (_libraryRepository.AuthorExists(id)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } return(NotFound()); }
public IActionResult GetBooksForAuuthor(Guid authorId) { if (!_libraryRepository.AuthorExists(authorId)) { return(NotFound()); } var booksForAuthorfromRepo = _libraryRepository.GetBooksForAuthor(authorId); var booksForAuthor = Mapper.Map <IEnumerable <BookDto> >(booksForAuthorfromRepo); booksForAuthor = booksForAuthor.Select(book => { book = CreateLinksForBook(book); return(book); }); var wrapper = new LinkedCollectionResourceWrapperDto <BookDto>(booksForAuthor); return(Ok(CreateLinksForBooks(wrapper))); }