Esempio n. 1
0
 public NewListModel()
 {
     ArticleModels  = new List <ArticleModel>();
     CategoryModels = new List <CategoryModel>();
     ArticleModel   = new ArticleModel();
     CategoryModel  = new CategoryModel();
     CategoryInfo   = new CategoryModel();
     PagedList      = new PagedList <ArticleModel>();
     Param          = new WebsiteArticleParam();
     GetArticleList = new List <ArticleModel>();
     // ShippingMethodServices=new List<CategoryModel>();
     //CategoryModelAbout=new List<CategoryModel>();
     //CategoryModelNews=new List<CategoryModel>();
     //HelpCenterList=new List<CategoryModel>();
     ShowCategoryListModel = new ShowCategoryListModel();
 }
Esempio n. 2
0
        public IPagedList <Article> GetArticleList(WebsiteArticleParam param)
        {
            if (param == null)
            {
                param = new WebsiteArticleParam();
            }
            Func <IQueryable <Article>, IOrderedQueryable <Article> > orderBy = x => x.OrderByDescending(x2 => x2.ArticleID);

            Expression <Func <Article, bool> > filter = x => true;

            filter = filter.AndIf(x => x.CategoryID == param.CategoryID, param.CategoryID != 0)
                     .AndIf(x => x.Status == param.Status, param.Status != null);

            IPagedList <Article> articles = _articleRepository.FindPagedList(param, filter, orderBy);

            return(articles);
        }