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 ActionResult Index(int page = 1) { var order = new SxOrderItem { FieldName = "DateCreate", Direction = SortDirection.Desc }; var filter = new SxFilter(page, _pageSize) { Order = order }; var viewModel = _repo.Read(filter); if (page > 1 && !viewModel.Any()) { return(new HttpNotFoundResult()); } ViewBag.Filter = filter; return(View(viewModel)); }