コード例 #1
0
 public ActionResult Search(CharacterListViewModel Params)
 {
     var vModel = CWorker.GenerateListView(Params);
     return View("Grid", vModel.Characters);
 }
コード例 #2
0
        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;
        }