¿Cómo descargar un ZipFile desde un wenet de núcleo dotnet?

Estoy tratando de descargar un archivo zip desde una acción de API web de dotnet core, pero no puedo hacer que funcione. Intenté llamar a la acción a través de POSTMAN y mi cliente Aurelia Http Fetch.

Puedo crear el archivo Zip como lo quiero y almacenarlo en el sistema, pero no puedo solucionarlo, por lo que devuelve el archivo zip a través de la API.

Caso de uso: el usuario selecciona un par de colecciones de imágenes y hace clic en el botón de descarga. Los identificadores de las colecciones de imágenes se envían a la API y se crea un archivo zip que contiene un directorio para cada colección de imágenes que contiene las imágenes. Ese archivo zip se devuelve al usuario para que pueda almacenarlo en su sistema.

Cualquier ayuda sería apreciada.

Mi acción de controlador

      /// <summary>
      /// Downloads a collection of picture collections and their pictures
      /// </summary>
      /// <param name="ids">The ids of the collections to download</param>
      /// <returns></returns>
      [HttpPost("download")]
      [ProducesResponseType(typeof(void), (int) HttpStatusCode.OK)]
      public async Task<IActionResult> Download([FromBody] IEnumerable<int> ids)
      {
           // Create new zipfile
           var zipFile = $"{_ApiSettings.Pictures.AbsolutePath}/collections_download_{Guid.NewGuid().ToString("N").Substring(0,5)}.zip";

           using (var repo = new PictureCollectionsRepository())
           using (var picturesRepo = new PicturesRepository())
           using (var archive = ZipFile.Open(zipFile, ZipArchiveMode.Create))
           {
                foreach (var id in ids)
                {
                     // Fetch collection and pictures
                     var collection = await repo.Get(id);
                     var pictures = await picturesRepo
                          .GetAll()
                          .Where(x => x.CollectionId == collection.Id)
                          .ToListAsync();

                     // Create collection directory IMPORTANT: the trailing slash
                     var directory = $"{collection.Number}_{collection.Name}_{collection.Date:yyyy-MM-dd}/";
                     archive.CreateEntry(directory);

                     // Add the pictures to the current collection directory
                     pictures.ForEach(x => archive.CreateEntryFromFile(x.FilePath, $"{directory}/{x.FileName}"));
                }
           }

           // What to do here so it returns the just created zip file?
      }
 }

Mi función de cliente de búsqueda de aurelia:

/**
 * Downloads all pictures from the picture collections in the ids array
 * @params ids The ids of the picture collections to download
 */
download(ids: Array<number>): Promise<any> {
    return this.http.fetch(AppConfiguration.baseUrl + this.controller + 'download', {
        method: 'POST',
        body: json(ids)
    })
}

Lo que he intentado

Tenga en cuenta que lo que he intentado no genera errores, simplemente no parece hacer nada.

1) Crear mi propio FileResult (como solía hacer con ASP.NET anterior). No puedo ver los encabezados en absoluto cuando lo llamo a través de cartero o la aplicación.

return new FileResult(zipFile, Path.GetFileName(zipFile), "application/zip");

 public class FileResult : IActionResult
 {
      private readonly string _filePath;
      private readonly string _contentType;
      private readonly string _fileName;

      public FileResult(string filePath, string fileName = "", string contentType = null)
      {
           if (filePath == null) throw new ArgumentNullException(nameof(filePath));

           _filePath = filePath;
           _contentType = contentType;
           _fileName = fileName;
      }

      public Task ExecuteResultAsync(ActionContext context)
      {
           var response = new HttpResponseMessage(HttpStatusCode.OK)
           {
                Content = new ByteArrayContent(System.IO.File.ReadAllBytes(_filePath))
           };

           if (!string.IsNullOrEmpty(_fileName))
                response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
                {
                     FileName = _fileName
                };

           response.Content.Headers.ContentType = new MediaTypeHeaderValue(_contentType);

           return Task.FromResult(response);
      }
 }

}

2)https://stackoverflow.com/a/34857134/2477872

No hace nada.

      HttpContext.Response.ContentType = "application/zip";
           var result = new FileContentResult(System.IO.File.ReadAllBytes(zipFile), "application/zip")
           {
                FileDownloadName = Path.GetFileName(zipFile)
           };
           return result;

Lo probé con un archivo PDF ficticio de prueba y parecía funcionar con POSTMAN. Pero cuando trato de cambiarlo al archivo zip (ver arriba) no hace nada.

  HttpContext.Response.ContentType = "application/pdf";
           var result = new FileContentResult(System.IO.File.ReadAllBytes("THE PATH/test.pdf"), "application/pdf")
           {
                FileDownloadName = "test.pdf"
           };

           return result;

Respuestas a la pregunta(1)

Su respuesta a la pregunta