public FileResult ContactRecords(int?memberId, int?ccgId, bool getAll = false, bool archive = false, string query = null, int?dateRangeFilter = (int)DateRangeFilter.SixMonths, int?dataDownloadFileType = (int)ExportDataFileType.Xls) { var fileType = dataDownloadFileType != null ? (ExportDataFileType)dataDownloadFileType : ExportDataFileType.Xls; var dateFilter = dateRangeFilter == null ? DateRangeFilter.ThreeMonths : (DateRangeFilter)dateRangeFilter; switch (fileType) { case ExportDataFileType.Xls: // Get contact records ActionResult actionResult; var user = unitOfWork.AppUserRepository.FindUserByEmail(User.Identity.Name); var contactRecords = _contactRecordsService.GetContactRecords(memberId, ccgId, getAll, archive, user, dateFilter, query, out actionResult); contactRecords = _contactRecordsService.SearchContactRecords(query, contactRecords); contactRecords = _contactRecordsService.RemovePrayerRequests(contactRecords); // Filter contact records by date range (eg. last 6 months) //_contactRecordsService.FilterContactsByDateRange(contactRecords.ToList(), dateFilter); // Export contact records to browser as xls file return(_service.ExportContactRecordsAsXls(contactRecords)); case ExportDataFileType.Csv: break; } //TODO temporary return(new FileContentResult(new byte[] { }, "")); }