Skip to content

Instantly share code, notes, and snippets.

@Macadoshis
Created July 9, 2019 10:02
Show Gist options
  • Save Macadoshis/84589747109c43b211c3a023c945d16a to your computer and use it in GitHub Desktop.
Save Macadoshis/84589747109c43b211c3a023c945d16a to your computer and use it in GitHub Desktop.
public IPaginatorRespDom<StringPairItemDom> OnLazyReference(string pattern, int start, int rows)
{
var withTranslationQuery = AsLabelTranslationsTranslatedQuery(x => x.Description, pattern);
Expression<Func<WithTranslation<MDMaterial, int>, bool>> filter = null;
if (isValidPattern(pattern))
{
filter = x => x.MdEntity.Name.ToUpper().Contains(pattern.ToUpper());
}
return new PaginatorRespDom<StringPairItemDom>()
{
Items = GetTranslatedPairItem<StringPairItemDom, int?>(withTranslationQuery, x => new StringPairItemDom()
{
RefId = x.MdEntity.Id,
RefValue = x.TranslatedValue
}, start, rows, filter),
TotalResults = GetFieldDistinctCount(
withTranslationQuery,
x => x.MdEntity.Id
)
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment