Esempio n. 1
0
        public async Task <IActionResult> GetBackupContent(string app, Guid id)
        {
            var backup = await backupservice.GetBackupAsync(AppId, id);

            if (backup == null || backup.Status != JobStatus.Completed)
            {
                return(NotFound());
            }

            var fileName = $"backup-{app}-{backup.Started:yyyy-MM-dd_HH-mm-ss}.zip";

            return(new FileCallbackResult("application/zip", fileName, false, bodyStream =>
            {
                return backupArchiveStore.DownloadAsync(id, bodyStream);
            }));
        }
        public async Task <IActionResult> GetBackupContent(string app, string id)
        {
            var backup = await backupservice.GetBackupAsync(AppId, id);

            if (backup == null || backup.Status != JobStatus.Completed)
            {
                return(NotFound());
            }

            var fileName = $"backup-{app}-{backup.Started:yyyy-MM-dd_HH-mm-ss}.zip";

            var callback = new FileCallback((body, range, ct) =>
            {
                return(backupArchiveStore.DownloadAsync(id, body, ct));
            });

            return(new FileCallbackResult("application/zip", callback)
            {
                FileDownloadName = fileName
            });
        }