コード例 #1
0
        public async Task <List <BookViewModel> > GetAllBook()
        {
            List <BookViewModel> bookList = new List <BookViewModel>();
            List <Book>          books    = await _bookstoreRepository.GetAllBook();

            if (books.Count != 0)
            {
                foreach (Book book in books)
                {
                    bookList.Add(new BookViewModel()
                    {
                        Id            = book.Id,
                        Author        = book.Author,
                        Title         = book.Title,
                        CoverImageUrl = book.CoverImage,
                        Description   = book.Description,
                        NumberOfPages = book.NumberOfPages
                    });
                }
            }
            return(bookList);
        }