Пример #1
0
        public void LinkMedia(string relation, string sourceMediaContentId, MediaDto linkedMedia)
        {
            var sourceMedia = this.DocumentList.FirstOrDefault(x => x.ContentId == sourceMediaContentId);

            if (sourceMedia == null)
            {
                throw new Exception("Cannot find the source media");
            }
            if (linkedMedia == null || linkedMedia.ContentId == null || linkedMedia.ContentId == sourceMediaContentId)
            {
                throw new Exception("Invalid linked media");
            }
            LinkedMediaDto lm = new LinkedMediaDto(relation, sourceMedia, linkedMedia);

            this.LinkedMediaList.Add(lm);
        }
Пример #2
0
        public void LinkMedia(string relation, MediaDto sourceMedia, MediaDto linkedMedia, Direction direction = Direction.Bi)
        {
            if (sourceMedia == null)
            {
                throw new Exception("Source Media cannot be null.");
            }
            if (!this.DocumentList.Contains(sourceMedia))
            {
                throw new Exception("Cannot find the source media");
            }
            if (linkedMedia == null)
            {
                throw new Exception("Cannot find the linked media");
            }
            LinkedMediaDto lm = new LinkedMediaDto(relation, sourceMedia, linkedMedia);

            lm.Direction = direction;
            this.LinkedMediaList.Add(lm);
        }