public async Task <IActionResult> ExportData([Bind("ID, Credential, Issues")] Project project) { var resultProj = await _context.Project.FirstOrDefaultAsync(e => e.ID == project.ID); if (resultProj != null) { resultProj.Issues = await _context.Issue.Where(e => e.ProjectId == resultProj.ID).ToListAsync(); exportService = ExportFactory.GetExportTo("xlsx"); var stream = exportService.Generate(resultProj); var response = File(stream, "application/octet-stream", "excelExport.xlsx"); // FileStreamResult return(response); } return(null); }