Esempio n. 1
0
        public void RemoveByImage(ImageViewModel image)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image == null");
            }

            ImageTagFacade.DeleteWhereIDIs(image.ID);

            var removeList = Chains.Where(it => it.ImageID == image.ID).ToList();

            foreach (var remove in removeList)
            {
                Chains.Remove(remove);
            }
        }
Esempio n. 2
0
        public static void Remove(ITagManager tagMng, ImageViewModel targetImage, string tagName)
        {
            bool tagExists = TagFacade.Exists(tagName);

            if (tagExists)
            {
                var tag = TagFacade.FindByTagName(tagName);
                ImageTagFacade.DeleteWhereIDIs(targetImage.ID, tag.ID);
                var willRemoves = tagMng.Chains.Where(a => a.ImageID == targetImage.ID && a.Tag.ID == tag.ID);
                if (willRemoves.Count() == 1)
                {
                    var willRemove = willRemoves.Single();
                    tagMng.Chains.Remove(willRemove);
                }
                s_logger.Info($"Removed ImageTag:{tag}");
            }
        }