Beispiel #1
0
        public IActionResult GetBook(int bookid)
        {
            if (!_bookrepository.BookExist(bookid))
            {
                return(NotFound());
            }
            var book = _bookrepository.GetBook(bookid);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var bookdto = new BookDto
            {
                Id            = book.Id,
                Title         = book.Title,
                Isbn          = book.isbn,
                DatePublished = book.DatePublished
            };

            return(Ok(bookdto));
        }