Пример #1
0
        SuccessListViewModel SuccessListTest(int page)
        {
            //var newsList = new List<MODEL.News>();
            //for (int i = 0; i < 300; i++)
            //{
            //    newsList.Add(new MODEL.News
            //    {
            //        NewsId = i,
            //        Title = "成功案例标题" + i,
            //        Content = "成功案例内容成功案例内容成功案例内容成功案例容成功案例内容成功案例内容成功案例内容成功案例内容成功案例内容成功案例内容成功案例内容成功案例内容",
            //        ImgPath = "/image/pcpj.jpg",
            //        PubDate = DateTime.Now,
            //        ReadCount = 100
            //    });
            //}
            var pagin = new Pagination(pageIndex: page - 1, recordCount: _successService.Count(null), pageSize: 6);

            return(new SuccessListViewModel(_successService.Get().OrderBy(e => e.Id).Skip(pagin.PageIndex * pagin.PageSize).Take(pagin.PageSize).ToList())
            {
                Pagination = pagin,
                FriendlyViewModel = new FriendlyListViewModel {
                    friendlylinks = _friendlylinkservice.Get().OrderBy(e => e.Id).ToList(), products = _product.Get().OrderBy(e => e.Id).Take(8).ToList()
                }
            });
        }
Пример #2
0
        NewsListViewModel NewsListByPager(int page)
        {
            var pagin = new Pagination(pageIndex: page - 1, recordCount: _newsService.Count(null), pageSize: 6);

            return(new NewsListViewModel(_newsService.Get().OrderBy(e => e.Id).Skip(pagin.PageIndex * pagin.PageSize).Take(pagin.PageSize).ToList())
            {
                Pagination = pagin,
                FriendlyViewModel = new FriendlyListViewModel {
                    friendlylinks = _friendlylinkservice.Get().OrderBy(e => e.Id).ToList(), products = _productService.Get().OrderBy(e => e.Id).Take(8).ToList()
                }
            });
        }