Example #1
0
        // TODO: 完善分类树的接口 完善从数据库读取的功能。


        /// <summary>
        /// 获取分类列表树
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public virtual async Task <List <CategoryDto> > GetAllListAsync(GetCategoryListDto input)
        {
            //var root =  _categoryRepository.Where(x => x.ParentId == null).ToList();

            // TODO: 把数据库查询 移到 Repository里面
            var root = ObjectMapper.Map <List <Category>, List <CategoryDto> >(
                _categoryRepository.Where(x => x.ParentId == input.ParentId).ToList());

            foreach (var ouDto in root)
            {
                await TraverseTreeAsync(ouDto, ouDto.Children);
            }
            return(root);
        }
Example #2
0
 public Task <PagedResultDto <CategoryDto> > GetListAsync(GetCategoryListDto input)
 {
     return(_service.GetListAsync(input));
 }
Example #3
0
 public async Task <PagedResultDto <CategorySummaryDto> > GetSummaryListAsync(GetCategoryListDto input)
 {
     return(await _service.GetSummaryListAsync(input));
 }
Example #4
0
 public Task <List <CategoryDto> > GetAllListAsync(GetCategoryListDto input)
 {
     return(_categoryAppService.GetAllListAsync(input));
 }