Beispiel #1
0
 public static SkuAttributeView ToVIew(SkuAttribute attribute)
 {
     if (attribute != null)
     {
         SkuAttributeView view = new SkuAttributeView
         {
             name  = attribute.Attribute == null ? string.Empty : attribute.Attribute.Name,
             value = attribute.AttributeValue == null ? string.Empty : attribute.AttributeValue.Value
         };
         return(view);
     }
     return(null);
 }
Beispiel #2
0
        public static IList <SkuAttributeView> ToViews(ICollection <SkuAttribute> attributes)
        {
            IList <SkuAttributeView> results = new List <SkuAttributeView>();

            if (attributes != null && attributes.Count > 0)
            {
                foreach (var item in attributes)
                {
                    results.Add(SkuAttributeView.ToVIew(item));
                }
            }
            return(results);
        }
Beispiel #3
0
        public static SkuDetailView ToView(Sku model)
        {
            SkuDetailView view = new SkuDetailView
            {
                id            = model.Id,
                content       = model.Content,
                price         = model.Sale.Price,
                productid     = model.ProductId,
                saleqty       = model.Sale.SaleQty,
                title         = model.Title,
                skuattributes = SkuAttributeView.ToViews(model.Attributes),
                imgs          = ImgDescView.ToViews(model.SkuImgs)
            };

            return(view);
        }