orchardcms - Orchard Pager For Module Admin -


so i've written simple module, , i'm displaying list of specific contentitems through adminmenu. works fine exception of pager. pager displaying count all contentitems, , not filtered list. i'm sure it's simple i'm missing, can't quite figure out.

here controller code:

    public actionresult list(listcontentsviewmodel model, pagerparameters pagerparameters) {         var pager = new pager(_siteservice.getsitesettings(), pagerparameters);         var query = _contentmanager.query<eventpart>(versionoptions.latest);          switch (model.options.orderby) {             case contentsorder.modified:                 query.orderbydescending<commonpartrecord>(cr => cr.modifiedutc);                 break;             case contentsorder.published:                 query.orderbydescending<commonpartrecord>(cr => cr.publishedutc);                 break;             case contentsorder.created:                 query.orderbydescending<commonpartrecord>(cr => cr.createdutc);                 break;         }          var pagershape = shape.pager(pager).totalitemcount(query.count());         var pageofcontentitems = query.slice(pager.getstartindex(), pager.pagesize).tolist();          var list = shape.list();         list.addrange(pageofcontentitems.select(ci => _contentmanager.builddisplay(ci, "summaryadmin")));          dynamic viewmodel = shape.viewmodel()                                  .contentitems(list)                                  .pager(pagershape)                                  .options(model.options);          // casting avoid invalid (under medium trust) reflection on protected view method , force static invocation.         return view((object)viewmodel);     } 

what doing wrong?

thanks!

okay, sake of documentation; right when commented thought .query<eventpart>. i'm not sure of logic behind it, query needed be:

var query = _contentmanager.query<eventpart, eventpartrecord>(versionoptions.latest); 

...with reference partrecord.

if provide comments on logic behind (and others reading this) can have better understanding, awesome!


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -