public async Task FilterAsync(IQuery <ContentItem> query, ListContentsViewModel model, PagerParameters pagerParameters, IUpdateModel updateModel) { var viewModel = new ListPartContentAdminFilterModel(); if (await updateModel.TryUpdateModelAsync(viewModel, "")) { // Show list content items if (viewModel.ShowListContentTypes) { var listableTypes = _contentDefinitionManager .ListTypeDefinitions() .Where(x => x.Parts.Any(p => p.PartDefinition.Name == nameof(ListPart))) .Select(x => x.Name); query.With <ContentItemIndex>(x => x.ContentType.IsIn(listableTypes)); } // Show contained elements for the specified list else if (viewModel.ListContentItemId != null) { query.With <ContainedPartIndex>(x => x.ListContentItemId == viewModel.ListContentItemId); } } }
public async Task FilterAsync(IQuery<ContentItem> query, ListContentsViewModel model, PagerParameters pagerParameters, IUpdateModel updateModel) { var viewModel = new ListPartContentAdminFilterModel(); if(await updateModel.TryUpdateModelAsync(viewModel, "")) { // Show list content items if (viewModel.ShowListContentTypes) { var listableTypes = _contentDefinitionManager .ListTypeDefinitions() .Where(x => x.Parts.Any(p => p.PartDefinition.Name == nameof(ListPart))) .Select(x => x.Name); query.With<ContentItemIndex>(x => x.ContentType.IsIn(listableTypes)); } // Show contained elements for the specified list else if(viewModel.ListContentItemId != 0) { query.With<ContainedPartIndex>(x => x.ListContentItemId == viewModel.ListContentItemId); } } }