private async Task <List <string> > GetChildCategoryIds(GetChildCategoryIds request) { string cacheKey = string.Format(ModelCacheEventConst.CATEGORY_CHILD_IDENTIFIERS_MODEL_KEY, request.ParentCategoryId, string.Join(",", request.Customer.GetCustomerRoleIds()), request.Store.Id); return(await _cacheBase.GetAsync(cacheKey, async() => { var categoriesIds = new List <string>(); var categories = await _categoryService.GetAllCategoriesByParentCategoryId(request.ParentCategoryId); foreach (var category in categories) { categoriesIds.Add(category.Id); request.ParentCategoryId = category.Id; categoriesIds.AddRange(await GetChildCategoryIds(request)); } return categoriesIds; })); }
public async Task <IList <string> > Handle(GetChildCategoryIds request, CancellationToken cancellationToken) { return(await GetChildCategoryIds(request)); }