public async Task DownloadFile()

in Webapp/SDAF/Controllers/FileController.cs [402:420]


        public async Task<ActionResult> DownloadFile(string id, string sourceController, string fileName, bool isImagesFile = false)
        {
            try
            {
                AppFile file = (isImagesFile) ? await GetImagesFile(fileName, 0, GetPartitionKey(id)) : await _appFileService.GetByIdAsync(id, GetPartitionKey(id));
                if (file == null) return NotFound();

                var stream = new MemoryStream(file.Content);
                return new FileStreamResult(stream, new MediaTypeHeaderValue("text/plain"))
                {
                    FileDownloadName = id
                };
            }
            catch (Exception e)
            {
                TempData["error"] = "Something went wrong downloading file " + id + ": " + e.Message;
                return RedirectToAction("Index", sourceController);
            }
        }