public ActionResult ViewRequisitionHistory(int?page, int?department, int?collectionPoint) { var requisitions = reqService.GetRequisitionByStatus(Status.Completed).OrderByDescending(r => r.RequisitionDate).ToList(); ViewBag.departments = reqService.GetDepartments(); ViewBag.collectionPoints = reqService.GetCollectionPoints(); if (department > 0) { requisitions = requisitions.Where(r => r.Employee.DepartmentID == department).ToList(); } if (collectionPoint > 0) { requisitions = requisitions.Where(r => r.Employee.Department.CollectionPointID == collectionPoint).ToList(); } ViewBag.department = department; ViewBag.collectionPoint = collectionPoint; int pageNumber = (page ?? 1); return(View("~/Views/Store/Clerk/ViewRequisitionHistory.cshtml", requisitions.ToPagedList(pageNumber, PAGE_SIZE))); }