Example #1
0
        public async Task <IActionResult> PolicyDocument([FromQuery] int id)
        {
            var p = await _policyManager.GetPolicyById(id);

            var    document = p.Documents[0];
            string filePath = policyDocumentsFolder + p.Id.ToString() + "/PolicyDocument";

            var result = await _fileManager.RetreiveFile(filePath, document.FileType);

            return(File(result, FileMimeTypeHelper.GetMimeType(document.FileType), document.Name + '.' + document.FileType));
        }
        /// <summary>
        /// Method to get the file Mime Type from file extension
        /// </summary>
        /// <param name="fileExt">The file ext.</param>
        /// <returns></returns>
        public static string GetMimeType(string fileExt)
        {
            var fileTypeHelper = new FileMimeTypeHelper();

            return(fileTypeHelper.GetMimeType(fileExt));
        }