Example #1
0
        public async Task <IActionResult> DeleteBook([FromRoute] int bookId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var book = _bookService.GetById(bookId);

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

            await _bookService.DeleteBookAsync(book);

            return(Ok(book));
        }