public ActionResult Preview(Guid id, int? page, int? pageSize) { MemberFilter f = DbContext.MemberFilters.Find(id); ViewBag.FilterId = id; ViewBag.FilterTitle = f.Title; if (page == null) page = 1; if (pageSize == null) pageSize = 12; FilterPreviewModel m = new FilterPreviewModel(); m.Filter = f; if (f.FilterClass == MemberFilterClass.Staff) { DynamicStaffFilter dsf = new DynamicStaffFilter(id); dsf.Refresh(); List<HRStaffRecord> rr = dsf.Execute(); ViewBag.Total = rr.Count().ToString(); PagedList<HRStaffRecord> pl = new PagedList<HRStaffRecord>(rr, page.Value, pageSize.Value); m.StaffList = pl; } else { DynamicStudentFilter stu = new DynamicStudentFilter(id); stu.Refresh(); List<StudentRecord> ss = stu.Execute(); ViewBag.Total = ss.Count().ToString(); PagedList<StudentRecord> pl = new PagedList<StudentRecord>(ss, page.Value, pageSize.Value); m.StudentList = pl; } return View(m); }
public PagedList<HRStaffRecord> GetStaffMembers(Guid id, int? page) { LcpsDbContext db = new LcpsDbContext(); MemberFilter f = db.MemberFilters.Find(id); if (page == null) page = 1; else { if (page == 0) page = 1; } DynamicStaffFilter stf = new DynamicStaffFilter(id); stf.Refresh(); List<HRStaffRecord> ss = stf.Execute(); PagedList<HRStaffRecord> pl = new PagedList<HRStaffRecord>(ss, page.Value, 12); return pl; }