diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs index 7e8f0208..b4e86367 100644 --- a/RMuseum/Services/IGanjoorService.cs +++ b/RMuseum/Services/IGanjoorService.cs @@ -1444,11 +1444,21 @@ namespace RMuseum.Services void FillCategoryWordCountsRowNmbrInCat(); /// - /// catgoru words count + /// category words count /// /// /// /// Task> CategoryWordCountsAsync(int catId, PagingParameterModel paging); + + /// + /// search in category words count + /// + /// + /// + /// + /// + Task> SearchInCategoryWordCountsAsync(int catId, string term, PagingParameterModel paging); + } } diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs index 791a0742..0d00db4f 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs @@ -20,7 +20,29 @@ namespace RMuseum.Services.Implementation public partial class GanjoorService : IGanjoorService { /// - /// catgoru words count + /// search in category words count + /// + /// + /// + /// + /// + public async Task> SearchInCategoryWordCountsAsync(int catId, string term, PagingParameterModel paging) + { + var source = + from cwd in _context.CategoryWordCounts + where cwd.CatId == catId && cwd.Word.Contains(term) + orderby cwd.RowNmbrInCat + select + cwd; + + (PaginationMetadata PagingMeta, CategoryWordCount[] Items) paginatedResult = + await QueryablePaginator.Paginate(source, paging); + + return new RServiceResult<(PaginationMetadata PagingMeta, CategoryWordCount[] Items)>(paginatedResult); + } + + /// + /// category word counts /// /// /// @@ -40,6 +62,7 @@ namespace RMuseum.Services.Implementation return new RServiceResult<(PaginationMetadata PagingMeta, CategoryWordCount[] Items)>(paginatedResult); } + /// /// build word counts ///