Is there a good way to programmatically pull a list of content items from Orchard?
At the moment, I am doing this, which returns ContentPartRecord and Title, but this is not very pretty:
public IEnumerable<LookupViewModel> Lookup(string searchText)
{
var items = _contentManager
.Query<MyItemPart, MyItemPartRecord>()
.Join<TitlePartRecord>()
.Where(x => x.Title.Contains(searchText))
.OrderBy(x => x.Title)
.List();
return items
.Select(x => new LookupViewModel()
{
Text = x.Name,
Value = x.Id.ToString()
});
}
Any pointers to relevant documentation would be greatly appreciated, in this respect very little for Orchard.
source
share