Exemple #1
0
 public Task <Stream> EmploeeReport(PeriodReportEmploeeModel model)
 {
     return(Task <Stream> .Run(() =>
     {
         using (ReportByEmployee report = new ReportByEmployee(_dbcontext, model.DFrom, model.DTo, model.EmploeeId))
         {
             report.Init();
             report.GenerateReport();
             return report.GetReportStream() as Stream;
         }
     }));
 }
Exemple #2
0
        public async Task <ActionResult> EmploeeReport(PeriodReportEmploeeModel model)
        {
            try
            {
                var doc_stream = await _reportService.EmploeeReport(model);

                doc_stream.Seek(0, SeekOrigin.Begin);
                return(File(doc_stream, "application/vnd.ms-excel", _reportService.GetReportName(3) + ".xlsx"));
            }
            catch
            {
                return(BadRequest());
            }
        }