public ActionResult Create(Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.AddObject(product);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ProductCategoryID = new SelectList(db.ProductCategories, "ProductCategoryID", "Name", product.ProductCategoryID);
            ViewBag.ProductModelID = new SelectList(db.ProductModels, "ProductModelID", "Name", product.ProductModelID);
            return View(product);
        }
 /// <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);
 }
 /// <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="productNumber">Initial value of the ProductNumber property.</param>
 /// <param name="standardCost">Initial value of the StandardCost property.</param>
 /// <param name="listPrice">Initial value of the ListPrice property.</param>
 /// <param name="sellStartDate">Initial value of the SellStartDate property.</param>
 /// <param name="rowguid">Initial value of the rowguid property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Product CreateProduct(global::System.Int32 productID, global::System.String name, global::System.String productNumber, global::System.Decimal standardCost, global::System.Decimal listPrice, global::System.DateTime sellStartDate, global::System.Guid rowguid, global::System.DateTime modifiedDate)
 {
     Product product = new Product();
     product.ProductID = productID;
     product.Name = name;
     product.ProductNumber = productNumber;
     product.StandardCost = standardCost;
     product.ListPrice = listPrice;
     product.SellStartDate = sellStartDate;
     product.rowguid = rowguid;
     product.ModifiedDate = modifiedDate;
     return product;
 }
 public ActionResult Edit(Product product)
 {
     if (ModelState.IsValid)
     {
         db.Products.Attach(product);
         db.ObjectStateManager.ChangeObjectState(product, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProductCategoryID = new SelectList(db.ProductCategories, "ProductCategoryID", "Name", product.ProductCategoryID);
     ViewBag.ProductModelID = new SelectList(db.ProductModels, "ProductModelID", "Name", product.ProductModelID);
     return View(product);
 }