cofoundry-cms / cofoundry

Cofoundry is an extensible and flexible .NET Core CMS & application framework focusing on code first development
https://www.cofoundry.org
MIT License
836 stars 146 forks source link

Implement Filtering. #449

Closed sunykumar closed 3 years ago

sunykumar commented 3 years ago

Hello How to Implement Filtering in custom entities (For Blog Categories). I have try to Implement but not working .This is code var Categoryid = Convert.ToInt32(HttpContext.Request.Cookies["CategoryId"]); var webQuery = new SearchBlogPostsQuery(); webQuery.CategoryId = Categoryid;
//--------- var query = new SearchCustomEntityRenderSummariesQuery(); query.CustomEntityDefinitionCode = BlogPostCustomEntityDefinition.DefinitionCode;
query.PageNumber = webQuery.PageNumber; query.PageSize = 5; var pagedResult = await _domainRepository.ExecuteQueryAsync(query);
ICollection pagedItems = pagedResult.Items; var state = await _visualEditorStateService.GetCurrentAsync(); query.PublishStatus = state.GetAmbientEntityPublishStatusQuery();

        // TODO: Filtering by Category (webQuery.CategoryId)
        // Searching/filtering custom entities is not implemented yet
        var entities = await _customEntityRepository.SearchCustomEntityRenderSummariesAsync(query);         
        // Examples of various properties and methods on IPagedResult<TResult>

        var viewModel = MapBlogPosts(entities);
        return View(viewModel);