In ASP.NET Core, I am using a Linq method to get my data from my `Prescriptions` table from the database, I am attempting to write that data to a csv file called `FutureFills.csv` in `wwwroot`, and download that file. Here is the controller

```
[HttpGet]
[Route("~/FutureFills")]
[Produces("text/csv")]
public IActionResult ExportFile()
{

    var futurefills = _context.Prescriptions
      .Where(f => f.FolderStatusId == 9)
      .Where(d => d.DeliveryDate == DateTime.Today.AddDays(1))
      .ToList();

    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    System.IO.StreamWriter write = new System.IO.StreamWriter(Stream);

    CsvFileDescription file = new CsvFileDescription 
    { 
        SeparatorChar = ',', FirstLineHasColumnNames = true 
    };

    return File(System.Text.Encoding.ASCII.GetBytes(futurefills.ToString()), "text/csv", "FutureFills.csv");
}

```

So I have a button on a page that calls this action and downloads a csv file, it downloads and seems to work but when I open the csv file it is not the data that I need, I am expecting to get the `Prescriptions` table from my database, however I get this in the csv file 

[![enter image description here](https://i.stack.imgur.com/7pIgN.png)](https://i.stack.imgur.com/7pIgN.png)

What am I doing wrong that it is not writing the correct data into the file?