예제 #1
0
        public virtual void AddProductLinks(Guid productLinkId,
                                            ProductLinkType productLinkType = ProductLinkType.Undefined)
        {
            if (ProductLinks.Any(x => x.LinkedProductId == productLinkId))
            {
                ProductLinks.RemoveAll(x => x.LinkedProductId == productLinkId);
            }

            ProductLinks.Add(new ProductLink(Id, productLinkId, productLinkType));
        }
예제 #2
0
 public IEnumerable <Product> GetLinkedProducts(ProductLinkType type) =>
 ProductLinks
 .Where(x => x.LinkType == type)
 .Select(x => x.LinkedProduct)
 .Where(x => !x.IsDeleted)
 .OrderBy(x => x.Id);
예제 #3
0
 public virtual void SetLinkType(ProductLinkType linkType)
 {
     LinkType = linkType;
 }
예제 #4
0
 public ProductLink(Guid productId, Guid linkedProductId, ProductLinkType linkType)
 {
     ProductId       = productId;
     LinkedProductId = linkedProductId;
     LinkType        = linkType;
 }