示例#1
0
 public static void CreateProduct(Product product)
 {
     using (Entities ctx = new Entities())
     {
         ctx.Products.AddObject(product);
         ctx.SaveChanges();
     }
 }
示例#2
0
        public ProductModel(Product product, double soldCount)
        {
            Id = product.Id;
            Name = product.Name;
            Description = product.Description;
            Price = product.Price;
            Image = product.Image;

            SoldCount = soldCount;
        }
示例#3
0
 /// <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;
 }
示例#4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProducts(Product product)
 {
     base.AddObject("Products", product);
 }
示例#5
0
 public ProductModel(Product product)
     : this(product, 0)
 {
 }