made get_book method async

This commit is contained in:
Ashraful Haque 2021-03-02 20:06:17 +00:00
parent 23ff9e95cb
commit 5a2d5ff366
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using TestApplication.Data;
using TestApplication.DTO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace TestApplication.Controllers
{
@ -19,7 +20,7 @@ namespace TestApplication.Controllers
}
[HttpGet]
public ActionResult<IEnumerable<BookDTO>> GetBooks()
public async Task<ActionResult<IEnumerable<BookDTO>>> GetBooks()
{
var book = from books in _context.Book
join book_descriptions in _context.Book_Description on books.id equals book_descriptions.book_id
@ -32,7 +33,7 @@ namespace TestApplication.Controllers
Book_description = book_descriptions.book_description
};
return Ok(book);
return await book.ToListAsync();
}
[HttpGet("{id}")]