public ActionResult Index(int page = 1)
        {
            var order = new SxOrderItem {
                FieldName = "de.[Order]", Direction = SortDirection.Desc
            };
            var filter = new SxFilter(page, _pageSize)
            {
                Order = order
            };

            var viewData = _repo.Read(filter);

            if (page > 1 && !viewData.Any())
            {
                return(new HttpNotFoundResult());
            }

            var viewModel = new SxPagedCollection <VMEducation>
            {
                Collection = viewData,
                PagerInfo  = filter.PagerInfo
            };

            ViewBag.Filter = filter;

            return(View(viewModel));
        }
Пример #2
0
        public ViewResult List(int page = 1)
        {
            var defaultOrder = new SxOrder { FieldName = "DateCreate", Direction = SortDirection.Desc };
            var filter = new SxFilter { Order = defaultOrder, OnlyShow = true };

            var data = Repo.Read(filter);

            var viewModel = new SxPagedCollection<VMSiteTest>
            {
                Collection = data,
                PagerInfo = filter.PagerInfo
            };

            ViewBag.Filter = filter;

            return View(model: viewModel);
        }
        public ActionResult Index(int page = 1)
        {
            var order = new SxOrderItem { FieldName = "Title", Direction = SortDirection.Asc };
            var filter = new SxFilter(page, _pageSize) { Order = order };

            var viewData = _repo.Read(filter);
            if (page > 1 && !viewData.Any())
                return new HttpNotFoundResult();

            var viewModel = new SxPagedCollection<VMService> {
                Collection = viewData,
                PagerInfo= filter.PagerInfo
            };

            ViewBag.Filter = filter;

            return View(viewModel);
        }
        public async Task <ViewResult> List(int page = 1)
        {
            var defaultOrder = new SxOrderItem {
                FieldName = "DateCreate", Direction = SortDirection.Desc
            };
            var filter = new SxFilter(page, _pageSize)
            {
                Order = defaultOrder, OnlyShow = true
            };

            var data = await Repo.ReadAsync(filter);

            var viewModel = new SxPagedCollection <VMSiteTest>
            {
                Collection = data,
                PagerInfo  = filter.PagerInfo
            };

            ViewBag.Filter = filter;

            return(View(model: viewModel));
        }