public IActionResult GenerateKpcExcel(int id) { //id in this case is a business trip Id and it takes all pieces of this business trip var pieces = _service.GetAll(); var excelName = _settings.Excel.KpcFileName; var memoryStream = ExcelGenerator.GetKpcExcelMemoryStream(pieces, _env.WebRootPath, _settings.Excel.FolderName, excelName); return(File(memoryStream, _excelFileType, excelName)); }