[HttpGet("{id}")]
public async Task<FileStreamResult> Download(int id)
{
var filename = "file"+id.ToString()+".txt";
var path = "Путь к файлу";
var stream = File.OpenRead(path);
return new FileStreamResult(stream, "application/octet-stream")
{
FileDownloadName = fileName
};
}