コード例 #1
0
        public IEnumerable <Label> SaveLabels(Topic topic, ImageLabel image, IEnumerable <Label> labels)
        {
            #region validation

            if (topic == null)
            {
                throw new ArgumentNullException(nameof(topic));
            }

            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            #endregion

            List <Label> result = new List <Label>();

            if (labels != null)
            {
                if (labels.Any())
                {
                    result = LabelRepository.AddOrUpdateOrDeleteLabels(topic, image, labels).ToList();
                }
                else
                {
                    LabelRepository.DeleteLabels(topic, image);
                }
            }

            return(result);
        }
コード例 #2
0
        public void DeleteLabels(Topic topic, ImageLabel image)
        {
            #region validation

            if (topic == null)
            {
                throw new ArgumentNullException(nameof(topic));
            }

            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            #endregion

            LabelRepository.DeleteLabels(topic, image);
        }