예제 #1
0
        public Tag Add(Tag tag)
        {
            TagEntity tagEntity = converterFactory.tagEntityConverter.Convert(tag);

            tagEntity = tagEntityDAO.Add(tagEntity);
            return(converterFactory.tagConverter.Convert(tagEntity, OnObjectCreation));
        }
예제 #2
0
        public Tag Get(int id)
        {
            Tag tag = tagCache.Keys.Where(t => t.Id == id).FirstOrDefault();

            if (tag == null)
            {
                TagEntity tagEntity = tagEntityDAO.Get(id);
                tag = converterFactory.tagConverter.Convert(tagEntity, OnObjectCreation);
            }
            return(tag);
        }
        public TagEntity Convert(Tag tag)
        {
            TagEntity tagEntity = daoFactory.TagEntityDAO.Get(tag.Id);

            if (tagEntity == null)
            {
                tagEntity = entityFactory.CreateTagEntity();
            }
            tagEntity.Name = tag.Name;
            tag.Products.ForEach(product =>
            {
                ProductTagEntity productTagEntity = GetProductTagEntity(product.Id, tag.Id);
                if (!tagEntity.ProductTagEntities.Contains(productTagEntity))
                {
                    tagEntity.ProductTagEntities.Add(productTagEntity);
                }
            });

            return(tagEntity);
        }
예제 #4
0
 public void Modify(TagEntity entity)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public TagEntity Add(TagEntity entity)
 {
     this.tagEntities.Add(entity);
     return(entity);
 }
예제 #6
0
        public void Modify(Tag tag)
        {
            TagEntity tagEntity = converterFactory.tagEntityConverter.Convert(tag);

            tagEntityDAO.Modify(tagEntity);
        }