Exemple #1
0
        /// <summary>
        /// GET the file and downloads it.
        /// </summary>
        /// <param name="getFileAttachedInputUnitId"></param>
        /// <returns></returns>
        public async Task <FileResult> GetFilesById(GetFileAttachedObjectInputUnit getFileAttachedInputUnitId)
        {
            var attachedObjectUnit = await _attachedObjectUnitAppService.GetFileAttachedObjecUnit(getFileAttachedInputUnitId);

            Response.AddHeader("Content-Disposition", "attachment; filename=\"" + attachedObjectUnit.FileName + "\"");
            return(File(attachedObjectUnit.Bytes, attachedObjectUnit.FileExtension));
        }
Exemple #2
0
        /// <summary>
        /// GET the File for Download
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <AttachedObjectUnitDto> GetFileAttachedObjecUnit(GetFileAttachedObjectInputUnit input)
        {
            var attachedObjectUnit = await _attachedObjectUnitRepository.GetAsync(input.AttachedObjectId);

            AttachedObjectUnitDto attachedObjectDto = new AttachedObjectUnitDto();

            var binaryObject = await _binaryObjectRepository.GetAsync(attachedObjectUnit.UserAttachmentFilesId.GetValueOrDefault());

            Mapper.Map(attachedObjectUnit, attachedObjectDto);

            attachedObjectDto.Bytes = binaryObject.Bytes;

            return(attachedObjectDto);
        }