Exemple #1
0
        public static Picture Create(
            string appPath,
            string originalPath,
            string name,
            string folderName,
            string folderAppPath,
            int folderSortOrder,
            int size,
            int globalSortOrder,
            DateTime?created = null
            )
        {
            if (string.IsNullOrWhiteSpace(appPath))
            {
                throw new ArgumentNullException($"Parameter {nameof(appPath)} cannot be empty");
            }

            string id = CryptographicHelper.HashValues(appPath);

            if (string.IsNullOrWhiteSpace(folderAppPath))
            {
                folderAppPath = appPath.Replace(name, "").Replace("\\", "").Replace("/", "");
            }

            string folderId = CryptographicHelper.HashValues(folderAppPath);

            return(new Picture(id)
            {
                _name = name,
                _appPath = appPath,
                _originalPath = originalPath,
                _folderName = folderName,
                _folderId = folderId,
                _folderSortOrder = folderSortOrder,
                _size = size,
                _createTimestamp = created ?? DateTime.UtcNow,
                _globalSortOrder = globalSortOrder
            });
        }