public ActionResult PopularSearchTermsReport(GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts)) { return(AccessDeniedView()); } var searchTermRecordLines = _searchTermService.GetStats(command.Page - 1, command.PageSize); var gridModel = new GridModel <SearchTermReportLineModel> { Data = searchTermRecordLines.Select(x => { return(new SearchTermReportLineModel() { Keyword = x.Keyword, Count = x.Count, }); }), Total = searchTermRecordLines.TotalCount }; return(new JsonResult { Data = gridModel }); }
public async Task <IActionResult> PopularSearchTermsReport(DataSourceRequest command) { if (!await _permissionService.Authorize(StandardPermissionProvider.ManageProducts)) { return(AccessDeniedView()); } var searchTermRecordLines = await _searchTermService.GetStats(command.Page - 1, command.PageSize); var gridModel = new DataSourceResult { Data = searchTermRecordLines.Select(x => new SearchTermReportLineModel { Keyword = x.Keyword, Count = x.Count, }), Total = searchTermRecordLines.TotalCount }; return(Json(gridModel)); }
public virtual ActionResult PopularSearchTermsReport(DataSourceRequest command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageArticles)) { return(AccessDeniedKendoGridJson()); } var searchTermRecordLines = _searchTermService.GetStats(command.Page - 1, command.PageSize); var gridModel = new DataSourceResult { Data = searchTermRecordLines.Select(x => new SearchTermReportLineModel { Keyword = x.Keyword, Count = x.Count, }), Total = searchTermRecordLines.TotalCount }; return(Json(gridModel)); }
/// <summary> /// Prepare paged popular search term list model /// </summary> /// <param name="searchModel">Popular search term search model</param> /// <returns>Popular search term list model</returns> public virtual PopularSearchTermListModel PreparePopularSearchTermListModel(PopularSearchTermSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get popular search terms var searchTermRecordLines = _searchTermService.GetStats(pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare list model var model = new PopularSearchTermListModel().PrepareToGrid(searchModel, searchTermRecordLines, () => { return(searchTermRecordLines.Select(searchTerm => new PopularSearchTermModel { Keyword = searchTerm.Keyword, Count = searchTerm.Count })); }); return(model); }
/// <summary> /// Prepare paged popular search term list model /// </summary> /// <param name="searchModel">Popular search term search model</param> /// <returns>Popular search term list model</returns> public virtual PopularSearchTermListModel PreparePopularSearchTermListModel(PopularSearchTermSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get popular search terms var searchTermRecordLines = _searchTermService.GetStats(pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare list model var model = new PopularSearchTermListModel { //fill in model values from the entity Data = searchTermRecordLines.Select(searchTerm => new PopularSearchTermModel { Keyword = searchTerm.Keyword, Count = searchTerm.Count }), Total = searchTermRecordLines.TotalCount }; return(model); }
/// <summary> /// Gets a search term statistics /// </summary> /// <param name="pageIndex">Page index</param> /// <param name="pageSize">Page size</param> /// <returns>A list search term report lines</returns> public IAPIPagedList <SearchTermReportLine> GetStats(int pageIndex = 0, int pageSize = int.MaxValue) { return(_searchTermService.GetStats(pageIndex, pageSize).ConvertPagedListToAPIPagedList()); }