Beispiel #1
0
        /// <summary>
        /// Save picture on file system
        /// </summary>
        /// <param name="pictureId">Picture identifier</param>
        /// <param name="pictureBinary">Picture binary</param>
        /// <param name="mimeType">MIME type</param>
        protected virtual void SavePictureInFile(int pictureId, byte[] pictureBinary, string mimeType)
        {
            var lastPart = GetFileExtensionFromMimeType(mimeType);
            var fileName = $"{pictureId:0000000}_0.{lastPart}";

            _fileProvider.WriteAllBytes(GetPictureLocalPath(fileName), pictureBinary);
        }
        /// <summary>
        /// Luu work file
        /// </summary>
        /// <param name="item"></param>
        /// <param name="fileContent"></param>
        void SaveWorkFileOnDisk(WorkFile item, byte[] fileContent)
        {
            string _pathStore = item.CreatedDate.ToPathFolderStore();

            _pathStore = _fileProvider.Combine(_fileProvider.MapPath(GSDataSettingsDefaults.FolderWorkFiles), _pathStore);
            _fileProvider.CreateDirectory(_pathStore);
            var _fileStore = _fileProvider.Combine(_pathStore, item.FileGuid.ToString() + item.Extension);

            _fileProvider.WriteAllBytes(_fileStore, fileContent);
        }