orchardcms - Displaying a list of content items that relate to one content type -


using orchard 1.6, i've set form allows user upload image (using field).

i want user able navigate search page (on dashboard) allows them search through uploads relating form. bear in mind, user have authority, can access dashboard (but can't access 'content' section, allows user search through content items). also, want content items content part listed.

i've set new controller , view, user can access empty page on dashboard. in function, want display list of content items content type , include search feature.

the trouble is, have done before have been using tables created myself ("supplier", example) , used loop add list if it's match, , display second list.

however, content items saved own contentitemrecord column:

<data><addresspart>       <name></name>       <addressline1></addressline1>       <addressline2></addressline2>       <zipcode></zipcode>       <city></city>       <country></country>       </addresspart> </data> 

how can use search?

i use orchard hql api, have found in cases need sort of search filters may change. if filters (like if can search either address or city) don't change use regular orchard api. here example of using hql api:

public class exampleservice : iexampleservice         {             private readonly icontentmanager _contentmanager;               public exampleservice                 (                 icontentmanager contentmanager                 )             {                 _contentmanager = contentmanager;             }      public ienumerable<contentitem>(){     ihqlquery query = _contentmanager.hqlquery().fortype("yourcontenttype");      //you can make joins on content parts , set criteria     action<ialiasfactory> selector = alias => alias.contentpartrecord<examplepartrecord>();         //put type of filter want here, can use conjunctions disjunctions.     action<ihqlexpressionfactory> filter = x => x.isnotnull("id");      query = query.where(selector,filter);      return query.list();     } } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -