public ActionResult Search(BookListViewModel Params) { var vModel = BWorker.GenerateListView(Params); return View("Grid", vModel.Books); }
public BookListViewModel GenerateListView(BookListViewModel baseObject) { var vModel = baseObject; IQueryable<Book> items; if(string.IsNullOrEmpty(baseObject.SearchTerm)) { items = Book.GetAll(Db); }else { items = Book.Query(Db, x => x.Title == baseObject.SearchTerm); } { } vModel.Books = new PageableSearchResults<IBook> { Items = items, CurPage = baseObject.PageNum, RecordsPerPage = 10 }; return vModel; }