Exemple #1
0
        public virtual void AddGalleryItem(string galleryItemId, int indexGlobal, string name, string appPath, string tags = "")
        {
            if (string.IsNullOrWhiteSpace(appPath))
            {
                throw new ArgumentNullException(nameof(appPath));
            }

            GalleryItem galleryItem = _galleryItems.FirstOrDefault(i => i.Id == galleryItemId);

            if (galleryItem == null)
            {
                galleryItem = GalleryItem.Create(
                    id: galleryItemId,
                    indexGlobal: indexGlobal,
                    indexGallery: _galleryItemsRunningIndex++,
                    name: name,
                    appPath: appPath,
                    mediaType: ParseMediaTypeFromName(name)
                    );

                _galleryItems.Add(galleryItem);
            }

            if (!string.IsNullOrWhiteSpace(tags))
            {
                foreach (var tag in tags.Split(','))
                {
                    galleryItem.AddTag(tag);
                }
            }
        }
Exemple #2
0
        internal static GalleryItem Create(string id, string appPath, int?indexGlobal, MediaType mediaType)
        {
            var item = new GalleryItem()
            {
                Id           = id,
                _indexGlobal = indexGlobal,
                _mediaType   = mediaType,
                _appPath     = appPath
            };

            return(item);
        }
Exemple #3
0
        internal static GalleryItem Create(string id, int indexGlobal, int indexGallery, string name, string appPath, MediaType mediaType)
        {
            var item = new GalleryItem(id)
            {
                _indexGlobal  = indexGlobal,
                _indexGallery = indexGallery,
                _name         = name,
                _mediaType    = mediaType,
                _appPath      = appPath
            };

            return(item);
        }
Exemple #4
0
        public virtual void AddGalleryItem(string galleryItemId, string mediaType, string appPath, string tags = "", int?indexGlobal = null)
        {
            if (string.IsNullOrWhiteSpace(galleryItemId))
            {
                throw new ArgumentNullException(nameof(galleryItemId));
            }
            if (string.IsNullOrWhiteSpace(appPath))
            {
                throw new ArgumentNullException(nameof(appPath));
            }

            var galleryItem = GalleryItem.Create(galleryItemId, appPath, indexGlobal, ParseMediaType(mediaType));

            if (!string.IsNullOrWhiteSpace(tags))
            {
                foreach (var tag in tags.Split(','))
                {
                    galleryItem.AddTag(tag);
                }
            }

            _galleryItems.Add(galleryItem);
        }