public ActionResult TestPerformed(TestPerformedListModelFilter filter = null, int pageNumber = 1) { int totalRecords = 0; if (filter == null) { filter = new TestPerformedListModelFilter { EventDateFrom = DateTime.Now.AddMonths(-1).Date, EventDateTo = DateTime.Now.Date } } ; var model = _testResultService.GetTestPerformed(pageNumber, _pageSize, filter, out totalRecords); if (model == null) { model = new TestPerformedListModel(); } filter.EventDateFrom = filter.EventDateFrom.HasValue ? filter.EventDateFrom.Value : DateTime.Now.AddMonths(-1).Date; filter.EventDateTo = filter.EventDateTo.HasValue ? filter.EventDateTo.Value : DateTime.Now; model.Filter = filter; var currentAction = ControllerContext.RouteData.Values["action"].ToString(); Func <int, string> urlFunc = pn => Url.Action(currentAction, new { pageNumber = pn, filter.EventDateFrom, filter.EventDateTo, filter.TechnicianId, filter.HealthPlanId, filter.EventId, filter.Pod, filter.IsCorporateEvent, filter.IsRetailEvent, filter.IsHealthPlanEvent, filter.TestId, filter.IsPdfGenerated }); model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc); return(View(model)); }