Last active
March 19, 2019 14:40
-
-
Save emrekizildas/5cea3fa5bca4ebc8300c4c33d37a898a 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("{id}")] | |
public async Task<ActionResult<BookInfoDto>> GetBook(int id) | |
{ | |
BookInfoDto book = await _db.Books | |
.Select(x => new BookInfoDto() { BookID = x.BookID, Name = x.Name, AuthorName = x.Author.Name }) | |
.SingleOrDefaultAsync(x => x.BookID == id); | |
if (book == null) | |
return NotFound("İstenilen kitap bulunamadı"); | |
return Ok(book); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment