예제 #1
0
 public ActionResult List(ListModel viewModel)
 {
     viewModel.ArticleQueryItem.UnitId = NpcMainWebContext.CurrentUnit.Id;
     viewModel.ArticleQueryItem.Pagination.PageIndex = PageIndex;
     var model = _indexAction.InitializeListModel(viewModel.ArticleQueryItem);
     return View(model);
 }
예제 #2
0
 public ListModel InitializeListModel(ArticleQueryItem queryItem)
 {
     var model = new ListModel();
     queryItem.UnitId = NpcMainWebContext.CurrentUnit.Id;
     model.ArticleQueryItem = queryItem;
     model.ArticleQueryItem.IsShow = true;
     model.Articles = _articleRepository.Query(queryItem).ToList();
     model.ListTitle = "文章列表";
     var categoryId = queryItem.CategoryId ?? queryItem.CategoryIdLike;
     if (categoryId.HasValue)
     {
         var category = _articleCategoryRepository.Find(categoryId.Value);
         if (category != null)
             model.ListTitle = category.CategoryName;
     }
     model.ArticleQueryItem = queryItem;
     return model;
 }