public IEnumerable <ArticleCategory> GetAllCategory(int state) { ArticleCategory ac = new ArticleCategory(); ac.category_state = state; ac.category_father_id = 0; var list = acDao.Select(ac); return(list); }
private IEnumerable <ArticleCategory> GetZazhiCategoryByCategoryCode(string fathercategory_code, int category_number) { ArticleCategoryDao acDao = new ArticleCategoryDao(); int father_id = articleCategoryBll.GetCategoryIdByCode(fathercategory_code); ArticleCategory ac = new ArticleCategory(); ac.category_father_id = father_id; IEnumerable <ArticleCategory> arList = acDao.Select(ac).Take(category_number);//获取该类别下所有类别 return(arList); }
public List <HomeCategoryArticleViewModel> GetAllCategoryByFatherCategory(string fathercategory_code, int number, int category_type = 1) { int father_id = articleCategoryBll.GetCategoryIdByCode(fathercategory_code); ArticleCategory ac = new ArticleCategory(); ac.category_father_id = father_id; ac.category_state = 0; ac.category_type = category_type; //1的时候小导航 2的时候首页三个 3的时候广告 IEnumerable <ArticleCategory> arList = acDao.Select(ac); //获取该类别下所有子类别 小导航条 List <HomeCategoryArticleViewModel> articleViewModelList = new List <HomeCategoryArticleViewModel>(); //获取各类别下面的文章 foreach (ArticleCategory item in arList) { HomeCategoryArticleViewModel articleViewModel = new HomeCategoryArticleViewModel(); articleViewModel.category_name = item.category_name; articleViewModel.articleList = articleBll.GetArticleByCategory(item.category_code, number).ToList(); //articleViewModel.adArticle = articleBll.GetArticleByCategory(item.category_code, 1).FirstOrDefault(); articleViewModelList.Add(articleViewModel); } return(articleViewModelList); }