Beispiel #1
0
        public async Task <IActionResult> AddBookAsync(string isbn)
        {
            Book book = await BookService.AddByISBNAsync(isbn);

            if (book == null)
            {
                return(HttpBadRequest("the provided ISBN does not resolve to a book in our backend service"));
            }

            var resource = await BookAssembler.ConvertToResourceAsync(book);

            return(CreatedAtRoute("api", new { id = book.Id }, resource));
        }