public static void CreateProduct(Product product) { using (Entities ctx = new Entities()) { ctx.Products.AddObject(product); ctx.SaveChanges(); } }
public ProductModel(Product product, double soldCount) { Id = product.Id; Name = product.Name; Description = product.Description; Price = product.Price; Image = product.Image; SoldCount = soldCount; }
/// <summary> /// Create a new Product object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="price">Initial value of the Price property.</param> public static Product CreateProduct(global::System.Guid id, global::System.String name, global::System.Decimal price) { Product product = new Product(); product.Id = id; product.Name = name; product.Price = price; return product; }
/// <summary> /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProducts(Product product) { base.AddObject("Products", product); }
public ProductModel(Product product) : this(product, 0) { }