public FileResult PrayerRequests(int?memberId, int?ccgId, int?dateRangeFilter = (int)DateRangeFilter.TwoWeeks, int?sortOption = (int)ContactsSort.DateDescending, bool getAll = false, string query = null) { var prayerReqService = new PrayerRequestService(unitOfWork); // Cast int passed by route to an enum var dateFilter = dateRangeFilter != null ? (DateRangeFilter)dateRangeFilter : DateRangeFilter.TwoWeeks; var contactsSort = sortOption == null ? ContactsSort.DateDescending : (ContactsSort)sortOption; // Get principal user obj var user = unitOfWork.AppUserRepository.FindUserByEmail(User.Identity.Name); var prayerRequests = prayerReqService.PrayerRequests(memberId, ccgId, dateFilter, contactsSort, getAll, query, user); // Export prayer requests to browser as xls file return(_service.ExportPrayerRequestsAsXls(prayerRequests)); }