public IActionResult ExportRelease(int idRelease, string codRelease, [FromServices] VivoDAO vivoDAO) { ReadExcel readExcel = new ReadExcel(_hostingEnvironment); List <TestesVivo> testesVivo = vivoDAO.ListaTestesVivo(idRelease); string url = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, $"{codRelease}.xlsx"); MemoryStream memoryStream = readExcel.DownloadTestesVivo(testesVivo, codRelease, url); return(File(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"{codRelease}.xlsx")); }