예제 #1
0
        public ActionResult Index(int page = 1)
        {
            var itemCount = GetInformations(GallaryTypeId).Count();
            var pageCount = itemCount / ConstsHelper.PageSize + Math.Min(1, itemCount % ConstsHelper.PageSize);

            page = Math.Max(1, page);
            page = Math.Min(page, pageCount);
            var model = new AbstractInformationIndexModel
            {
                Items = GetInformations(GallaryTypeId)
                        .Skip((page - 1) * ConstsHelper.PageSize)
                        .Take(ConstsHelper.PageSize)
                        .ToList()
                        .Select(i => (AbstractInformationModel) new GalleryModel(i))
                        .ToList(),
                Page      = page,
                PageCount = pageCount,
                Action    = "Index"
            };

            return(View(model));
        }
예제 #2
0
        public ActionResult Index(int page = 1)
        {
            var itemCount = GetInformations(ArticleTypeId).Count();
            var pageCount = itemCount / ConstsHelper.PageSize + Math.Min(1, itemCount % ConstsHelper.PageSize);

            page = Math.Max(1, page);
            page = Math.Min(page, pageCount);
            var model = new AbstractInformationIndexModel
            {
                Items = GetInformations(ArticleTypeId)
                        .Skip((page - 1) * ConstsHelper.PageSize)
                        .Take(ConstsHelper.PageSize)
                        .ToList()
                        .Select(i => (AbstractInformationModel) new ArticleModel(i))
                        .ToList(),
                Page      = page,
                PageCount = pageCount,
                Action    = "Index"
            };

            model.Items.ForEach(i => ((ArticleModel)i).Counter = _db.Counters.Count(e => e.InformationId == i.Id));
            return(View(model));
        }