public ProductViewModel(Domain.DomainClasses.Product product) { Id = product.Id; Name = product.Name; Provision = product.Provision; StartPrice = product.GetStartPrice(); SupplierName = product.Supplier.Name; IsSold = product.IsSold; if (product is AntiqueProduct) { Type = ProductType.Antique; TimeEpoch = ((AntiqueProduct)product).TimeEpoch.ToString(); } if (product is ModernProduct) { Type = ProductType.Modern; DesignerName = ((ModernProduct)product).Designer.Name; } if (product is MassProduct) { Type = ProductType.Mass; DesignerName = ((MassProduct)product).Designer.Name; } }
public void Add(Domain.DomainClasses.Product product) { _db.Products.Add(product); Update(); }