Fix category search indexing

This commit is contained in:
Mbucari 2023-07-18 16:00:06 -06:00
parent 3211b2dc85
commit 4e34834c35
2 changed files with 11 additions and 2 deletions

View file

@ -61,7 +61,15 @@ namespace DataLayer
.Distinct()
.ToArray();
public static string[] CategoriesIds(this Book book)
public static string[] AllCategoryNames(this Book book)
=> book.CategoriesLink?.Any() is not true ? Array.Empty<string>()
: book
.CategoriesLink
.SelectMany(cl => cl.CategoryLadder.Categories)
.Select(c => c.Name)
.ToArray();
public static string[] AllCategoryIds(this Book book)
=> book.CategoriesLink?.Any() is not true ? null
: book
.CategoriesLink