public ActionResult Search(CharacterListViewModel Params) { var vModel = CWorker.GenerateListView(Params); return View("Grid", vModel.Characters); }
public CharacterListViewModel GenerateListView(CharacterListViewModel baseObject) { var vModel = baseObject; IQueryable<Character> items; if(string.IsNullOrEmpty(baseObject.SearchTerm)) { items = Character.GetAll(Db); }else { items = Character.Query(Db, x => x.Name == baseObject.SearchTerm); } { } vModel.Characters = new PageableSearchResults<ICharacter> { Items = items, CurPage = baseObject.PageNum, RecordsPerPage = 10 }; return vModel; }