public IHttpActionResult DownloadUnitReport(int reportId, ExcelReportType excelReportType = ExcelReportType.List)
 {
     if (!_userContext.CurrentUserIsSystemUser())
     {
         return(Unauthorized());
     }
     return(_queryService.DownloadUnitReportViewModel(reportId, excelReportType).ToExcel($"UnitReport_{ZaphodTime.UtcNow.ToFileTime()}.xlsx"));
 }
Example #2
0
        public byte[] DownloadStateReportViewModel(int reportId, ExcelReportType excelReportType)
        {
            var report = GetStateReportViewModel(reportId);

            return(excelReportType == ExcelReportType.List
                ? _excelReportFactory.CreateExcelReport(new SearchResult <StateReportViewModel>(
                                                            new List <StateReportViewModel>()
            {
                report
            },
                                                            new PagingData(1,
                                                                           DefaultPageSize,
                                                                           1)
                                                            ))
                : _excelReportFactory.CreateExcelReport(report));
        }