public static ProductDetailView ToView(Product product) { ProductDetailView result = new ProductDetailView { id = product.Id, propertyname = product.PropertyName, title = product.Title, sku = SkuDetailView.ToView(product.Skus.FirstOrDefault()), properties = ProductPropertyValueView.ToViews(product.PropertyValues) }; return(result); }
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); }