Skip to content

Commit b9ea0f2

Browse files
EXPOSERS: Get All Books
1 parent db36635 commit b9ea0f2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

LibraryManagement.Api/Controllers/BooksController.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,24 @@ public async ValueTask<ActionResult<Book>> PostBookAsync(Book book)
5353
return InternalServerError(bookServiceException.InnerException);
5454
}
5555
}
56+
57+
[HttpGet("all")]
58+
public ActionResult<IQueryable<Book>> GetAllBooks()
59+
{
60+
try
61+
{
62+
IQueryable<Book> allBooks = this.bookService.RetrieveAllBooks();
63+
64+
return Ok(allBooks);
65+
}
66+
catch (BookDependencyException bookDependencyException)
67+
{
68+
return InternalServerError(bookDependencyException.InnerException);
69+
}
70+
catch (BookServiceException bookServiceException)
71+
{
72+
return InternalServerError(bookServiceException.InnerException);
73+
}
74+
}
5675
}
5776
}

0 commit comments

Comments
 (0)