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); }
public async Task<List<Category>> GetAllWithCategoryBlogsAsyns() { return await _categoryDal.GetAllWithCategoryBlogsAsync(); }