public async Task <ActionResult <GetBookDetailsResponse> > AddABook([FromBody] PostBookCreate bookToAdd)
        {
            var response = await _bookCommands.AddBook(bookToAdd);

            // return a 201, with location header, with a copy of what they'd get from that location

            return(CreatedAtRoute("books#getbyid", new { bookId = response.Id }, response));
        }
示例#2
0
        public async Task <ActionResult <GetBookDetailsResponse> > AddABook([FromBody] PostBookCreate bookToAdd)
        {
            GetBookDetailsResponse response = await _bookCommands.AddBook(bookToAdd);

            return(CreatedAtRoute("books#getbyid", new { bookId = response.Id }, response));
        }