public async Task <PaginationModelView <BookModel> > Search(BookModel book, int page = 0) { PaginationModelView <BookModel> result = _bookService.Search(book, page); result.items = await prepareSearchResults(result.items); return(result); }
public async Task <PaginationModelView <BookViewModel> > Get(string search, int page) { if (page < 0) { page = 0; } else if (page > 0) { page--; } PaginationModelView <BookModel> result = await _book.Search(search, page); return(new PaginationModelView <BookViewModel>() { currentPage = result.currentPage, elementsPerPage = result.elementsPerPage, totalItems = result.totalItems, items = result.items.Select(b => b.getViewModel()).ToList() }); }