示例#1
0
        public ActionResult <Book> GetBook(int id, int authorId)
        {
            var book = booksServices.GetBook(id, authorId);

            if (book == null)
            {
                return(NotFound($"No exite el libro con id: {id}"));
            }
            return(book);
        }
示例#2
0
 public ActionResult <BookModel> GetBook(int BookId)
 {
     try
     {
         return(Ok(_booksServices.GetBook(BookId)));
     }
     catch (NotFoundOperationException ex)
     {
         return(NotFound(ex.Message));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, $"Something Happened: {ex.Message}"));
     }
 }