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)); }
public IEnumerable <Product> GetLinkedProducts(ProductLinkType type) => ProductLinks .Where(x => x.LinkType == type) .Select(x => x.LinkedProduct) .Where(x => !x.IsDeleted) .OrderBy(x => x.Id);
public virtual void SetLinkType(ProductLinkType linkType) { LinkType = linkType; }
public ProductLink(Guid productId, Guid linkedProductId, ProductLinkType linkType) { ProductId = productId; LinkedProductId = linkedProductId; LinkType = linkType; }