示例#1
0
        public async Task <List <CategoryWithBlogsCountDto> > GetAllWithCategoryBlogsAsync()
        {
            var categories = await _categoryDal.GetAllWithCategoryBlogsAsync();

            var listCategory = new List <CategoryWithBlogsCountDto>();

            foreach (var category in categories)
            {
                var dto = new CategoryWithBlogsCountDto
                {
                    CategoryName = category.Name,
                    CategoryId   = category.Id,
                    BlogsCount   = category.CategoryBlogs.Count
                };

                listCategory.Add(dto);
            }

            return(listCategory);
        }
示例#2
0
 public async Task<List<Category>> GetAllWithCategoryBlogsAsyns()
 {
     return await _categoryDal.GetAllWithCategoryBlogsAsync();
 }