Created
March 19, 2019 14:43
-
-
Save emrekizildas/9d4471b0ae71d93902f8bb6370f0f81a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
public async Task<IActionResult> GetBooks() | |
{ | |
List<BookInfoDto> books = await _db.Books | |
.Select(x => new BookInfoDto() { BookID = x.BookID, Name = x.Name, AuthorName = x.Author.Name }) | |
.ToListAsync(); | |
if (books.Count() == 0) | |
return NotFound(); | |
return Ok(books); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment