public ActionResult Create(DependenciaMaterial dependenciamaterial)
        {
            if (ModelState.IsValid)
            {
                db.DependenciaMaterial.AddObject(dependenciamaterial);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.IdMaterialFilho = new SelectList(db.Material, "Id", "Codigo", dependenciamaterial.IdMaterialFilho);
            ViewBag.IdMaterialPai = new SelectList(db.Material, "Id", "Codigo", dependenciamaterial.IdMaterialPai);
            return View(dependenciamaterial);
        }
 public ActionResult Edit(DependenciaMaterial dependenciamaterial)
 {
     if (ModelState.IsValid)
     {
         db.DependenciaMaterial.Attach(dependenciamaterial);
         db.ObjectStateManager.ChangeObjectState(dependenciamaterial, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.IdMaterialFilho = new SelectList(db.Material, "Id", "Codigo", dependenciamaterial.IdMaterialFilho);
     ViewBag.IdMaterialPai = new SelectList(db.Material, "Id", "Codigo", dependenciamaterial.IdMaterialPai);
     return View(dependenciamaterial);
 }
 /// <summary>
 /// Create a new DependenciaMaterial object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="idMaterialFilho">Initial value of the IdMaterialFilho property.</param>
 /// <param name="quantidade">Initial value of the Quantidade property.</param>
 /// <param name="ordem">Initial value of the Ordem property.</param>
 public static DependenciaMaterial CreateDependenciaMaterial(global::System.Int32 id, global::System.Int32 idMaterialFilho, global::System.Double quantidade, global::System.Int32 ordem)
 {
     DependenciaMaterial dependenciaMaterial = new DependenciaMaterial();
     dependenciaMaterial.Id = id;
     dependenciaMaterial.IdMaterialFilho = idMaterialFilho;
     dependenciaMaterial.Quantidade = quantidade;
     dependenciaMaterial.Ordem = ordem;
     return dependenciaMaterial;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the DependenciaMaterial EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDependenciaMaterial(DependenciaMaterial dependenciaMaterial)
 {
     base.AddObject("DependenciaMaterial", dependenciaMaterial);
 }