public ProductModelDetail(ProductEntity item, CategoryEntity category) { this.ProductId = item.ProductID; this.CateId = item.CatalogID; this.Name = item.Name; this.Price = item.Price; this.PriceFormat = string.Format("{0:n0} ₫", item.Price).Replace(",", "."); this.Discount = item.Discount; this.SaleOffPrice = item.SaleOffPrice; this.Code = item.Code; this.Avatar = item.Avatar; if (item.Weight.ToInt(0) > 0) { this.Weight = string.Format("{0:n0}{1}", item.Weight, item.UnitType == 0 ? "g" : "kg"); } this.UnitType = item.UnitType; this.ShortDescription = item.ShortDescription; this.Description = item.Description; this.CreatedDate = item.CreatedDate; this.LastModifiedDate = item.LastModifiedDate; this.Status = item.Status; this.URL = BuildLink.BuildURLForProduct(category.DisplayUrl, item.Name, item.ProductID); ListImage = new List <ProductImage>(); ListImage.Add(new ProductImage { Link = item.Avatar }); //ListImage.Add(new ProductImage { Link = item.Avatar }); //ListImage.Add(new ProductImage { Link = item.Avatar }); //ListImage.Add(new ProductImage { Link = item.Avatar }); //ListImage.Add(new ProductImage { Link = item.Avatar }); //ListImage.Add(new ProductImage { Link = item.Avatar }); }
public ProductModel(ProductEntity item, CategoryEntity category) { this.ProductId = item.ProductID; this.CateId = item.CatalogID; this.Name = item.Name; this.Price = item.Price; this.PriceFormat = string.Format("{0:n0} ₫", item.Price).Replace(",", "."); this.Discount = item.Discount; this.SaleOffPrice = item.SaleOffPrice; this.Code = item.Code; this.Avatar = item.Avatar; if (item.Weight.ToInt(0) > 0) { this.Weight = string.Format("{0:n0}{1}", item.Weight, item.UnitType == 0 ? "g" : "kg"); } this.UnitType = item.UnitType; this.CreatedDate = item.CreatedDate; this.LastModifiedDate = item.LastModifiedDate; this.URL = BuildLink.BuildURLForProduct(category.DisplayUrl, item.Name, item.ProductID); }