private SalesViewModel(ETC.Product product) { this.id = product.ID; this.name = product.Name; this.description = product.Description; this.price = product.Price; this.imageName = product.ImageName; this.imageSrc = PathUtility.CombineUrls(Config.StorageUrlProduct, product.ID.ToString(), product.ImageName); this.category = product.ExecuteCreateCategoryByCategoryID().Name; this.categoryID = product.CategoryID; this.status = (product.Status == ETC.Product.STATUS_ACTIVE) ? true : false; this.sellings = CountSells(product); }
private ProductViewModel(ETC.Product product) { this.id = product.ID; this.name = product.Name; this.description = product.Description; this.price = product.Price; this.imageName = product.ImageName; this.status = (product.Status == ETC.Product.STATUS_ACTIVE) ? true : false; this.categoryID = product.CategoryID; this.entity = product; this.category = product.ExecuteCreateCategoryByCategoryID(); this.categoryList = Lists.ListCategories(ETC.Category.ListByStatus(ETC.Category.STATUS_ACTIVE), Lists.SelectorType.WithSelect, null); this.isEditMode = true; }
public ShopViewModel(ETC.Product product) { if (product != null) { this.id = product.ID; this.name = product.Name; this.description = product.Description; this.price = product.Price; this.imageSrc = PathUtility.CombineUrls(Config.StorageUrlProduct, product.ID.ToString(), product.ImageName); this.category = product.ExecuteCreateCategoryByCategoryID().Name; this.categoryID = product.CategoryID; this.status = (product.Status == ETC.Product.STATUS_ACTIVE) ? true : false; this.quantity = 1; } }