Exemplo n.º 1
0
        public async Task <ActionResult <Book> > GetBook()
        {
            var book = await _context.GetBook();

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

            return(Ok(book));
        }
Exemplo n.º 2
0
        // Selects a book by ID and returns to BookDetail

        public ActionResult BookDetail(int?BookId)
        {
            if (BookId == null)
            {
                return(HttpNotFound());
            }

            // Selects the book based on Book.Id

            var book = booksContext.GetBook((int)BookId);

            return(View(book));
        }