Exemple #1
0
        /// <summary>
        /// Gets the content for an attribute if available.
        /// </summary>
        /// <param name="variant">
        /// The variant.
        /// </param>
        /// <param name="attributeKey">
        /// The attribute key.
        /// </param>
        /// <returns>
        /// The <see cref="IProductAttributeContent"/>.
        /// </returns>
        public static IProductAttributeContent GetContentForAttribute(this IProductVariantContent variant, Guid attributeKey)
        {
            if (!variant.AttributeHasContent(attributeKey))
            {
                return(null);
            }

            var pv = variant as ProductVariantContent;

            if (pv == null)
            {
                return(null);
            }
            return(pv.AttributeContent.FirstOrDefault(x => x.Key == attributeKey));
        }
Exemple #2
0
 /// <summary>
 /// Returns a value indicating whether or not an attribute has property content.
 /// </summary>
 /// <param name="variant">
 /// The variant.
 /// </param>
 /// <param name="attribute">
 /// The attribute.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public static bool AttributeHasContent(this IProductVariantContent variant, ProductAttributeDisplay attribute)
 {
     return(variant.AttributeHasContent(attribute.Key));
 }