示例#1
0
 public virtual Task <PagedResultDto <ProductViewDto> > GetListAsync(GetProductListInput input)
 {
     return(_service.GetListAsync(input));
 }
示例#2
0
        public async Task <PagedResultOutputDto <CategoryOutput> > GetCategoryListAsync(GetProductListInput input)
        {
            var query = _categoryRepository.GetAll().
                        WhereIf(!string.IsNullOrEmpty(input.Name), x => x.Name == input.Name);
            var count  = query.Count();
            var result = await query.OrderBy(x => x.Sort).ThenByDescending(x => x.CreationTime).Skip(input.SkipCount).Take(input.PageCount).ToListAsync();

            var reusltOut = result.MapTo <List <CategoryOutput> >();

            foreach (var categoryOutput in reusltOut)
            {
                var firstOrDefault
                    = FileRelationRepository
                      .GetAll().FirstOrDefault
                          (x => x.KeyId == categoryOutput.Id &&
                          x.ModuleId == ModuleType.Category);
                if (firstOrDefault != null)
                {
                    categoryOutput.FileId = firstOrDefault
                                            .FileId;
                }
            }
            return(new PagedResultOutputDto <CategoryOutput>(count, reusltOut));
        }