public async Task <GetAllBookView> GetAll() { var allbooks = (await _bookrepository.GetAll()).Select(x => new BookGetAllBookItemView { Id = x.Id, Title = x.Title, Price = x.Price }).ToList(); var result = new GetAllBookView() { books = allbooks }; return(result); }
public async Task <GetAllBookView> GetAll() { var books = await _bookRepository.GetAll(); var model = new GetAllBookView(); model.Books = books.Select(x => new BookGetAllBookViewItem() { Id = x.Id, Name = x.Name, Author = x.Author, Price = x.Price }).ToList(); return(model); }