Exemple #1
0
        public static Association ToWebModel(this catalogModel.ProductAssociation association)
        {
            Association retVal = null;

            if (association.AssociatedObjectType.EqualsInvariant("product"))
            {
                retVal = new ProductAssociation
                {
                    ProductId = association.AssociatedObjectId
                };
            }
            else if (association.AssociatedObjectType.EqualsInvariant("category"))
            {
                retVal = new CategoryAssociation
                {
                    CategoryId = association.AssociatedObjectId
                };
            }

            if (retVal != null)
            {
                retVal.InjectFrom <NullableAndEnumValueInjecter>(association);
                retVal.Image = new Image {
                    Url = association.AssociatedObjectImg
                };
            }

            return(retVal);
        }
        public static ProductAssociation ToWebModel(this catalogModel.ProductAssociation association)
        {
            var retVal = new ProductAssociation();

            retVal.InjectFrom <NullableAndEnumValueInjecter>(association);
            retVal.ProductImage = new Image()
            {
                Url = association.ProductImg
            };
            retVal.ProductName = association.ProductName;
            retVal.ProductSku  = association.ProductCode;
            return(retVal);
        }