示例#1
0
 public ActionResult Search(BookListViewModel Params)
 {
     var vModel = BWorker.GenerateListView(Params);
     return View("Grid", vModel.Books);
 }
示例#2
0
        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;
        }