Пример #1
0
        public IQueryable<Model.Product> InsertProduct(Model.Product product)
        {
            int newId;

            //using (ScutexEntities db1 = new ScutexEntities())
            //{
            Product prod = new Product();

            Mapper.CreateMap<Model.Product, Product>();
            prod = Mapper.Map<Model.Product, Product>(product);

            db.AddToProducts(prod);
            db.SaveChanges();

            newId = prod.ProductId;
            //}

            return GetProductById(newId);
        }
Пример #2
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);
 }
Пример #3
0
 /// <summary>
 /// Create a new Product object.
 /// </summary>
 /// <param name="productId">Initial value of the ProductId property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="uniquePad">Initial value of the UniquePad property.</param>
 public static Product CreateProduct(global::System.Int32 productId, global::System.String name, global::System.String description, global::System.String uniquePad)
 {
     Product product = new Product();
     product.ProductId = productId;
     product.Name = name;
     product.Description = description;
     product.UniquePad = uniquePad;
     return product;
 }