Exemplo n.º 1
0
        public async Task <FileResult> DownloadFile(string name)
        {
            FileContentResult result = null;

            if (!string.IsNullOrEmpty(name))
            {
                string path = await _azureService.DownloadFileAsync(name);

                byte[] binaryContent = System.IO.File.ReadAllBytes(path);
                string fileName      = System.IO.Path.GetFileName(path);
                string mimeType      = _iOService.GetMimeTypeByWindowsRegistry(fileName);

                if (binaryContent != null)
                {
                    result = new FileContentResult(binaryContent, mimeType)
                    {
                        FileDownloadName = fileName,
                    };
                }
            }
            return(result);
        }