|
@@ -99,8 +99,11 @@ namespace GxPress.Repository.Implement.Category
|
|
|
public async Task<IEnumerable<CategoryResult>> GetCategoryAllAsync(int typeValue = 0)
|
|
|
{
|
|
|
var categoryAll = await GetAllAsync(typeValue);
|
|
|
+ var result = new List<CategoryResult>();
|
|
|
+ result.Add(new CategoryResult { Id = 0, Name = "推荐", IsDisable = false });
|
|
|
var categoryResults = categoryAll.Where(n => n.ParentId == 0).Select(n => _mapper.Map<CategoryResult>(n)).ToList();
|
|
|
- foreach (var item in categoryResults)
|
|
|
+ result.AddRange(categoryResults);
|
|
|
+ foreach (var item in result)
|
|
|
{
|
|
|
item.IsChildren = categoryAll.Any(n => n.ParentId == item.Id);
|
|
|
item.Children = categoryAll.Where(n => n.ParentId == item.Id).Select(n => _mapper.Map<CategoryResult>(n)).ToList();
|
|
@@ -113,7 +116,7 @@ namespace GxPress.Repository.Implement.Category
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return categoryResults;
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
}
|