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

            ViewBag.TipoOrdem = new SelectList(db.TipoOrdem, "Id", "Nome", material.TipoOrdem);
            ViewBag.TipoReposicao = new SelectList(db.TipoReposicao, "Id", "Nome", material.TipoReposicao);
            return View(material);
        }
 public ActionResult Edit(Material material)
 {
     if (ModelState.IsValid)
     {
         db.Material.Attach(material);
         db.ObjectStateManager.ChangeObjectState(material, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TipoOrdem = new SelectList(db.TipoOrdem, "Id", "Nome", material.TipoOrdem);
     ViewBag.TipoReposicao = new SelectList(db.TipoReposicao, "Id", "Nome", material.TipoReposicao);
     return View(material);
 }
 /// <summary>
 /// Create a new Material object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="codigo">Initial value of the Codigo property.</param>
 /// <param name="descricao">Initial value of the Descricao property.</param>
 /// <param name="tipoReposicao">Initial value of the TipoReposicao property.</param>
 /// <param name="tipoOrdem">Initial value of the TipoOrdem property.</param>
 /// <param name="estoqueSeguranca">Initial value of the EstoqueSeguranca property.</param>
 /// <param name="dataCriacao">Initial value of the DataCriacao property.</param>
 /// <param name="dataModificacao">Initial value of the DataModificacao property.</param>
 /// <param name="leadTime">Initial value of the LeadTime property.</param>
 /// <param name="estoqueMinimo">Initial value of the EstoqueMinimo property.</param>
 /// <param name="loteReposicao">Initial value of the LoteReposicao property.</param>
 public static Material CreateMaterial(global::System.Int32 id, global::System.String codigo, global::System.String descricao, global::System.Int32 tipoReposicao, global::System.Int32 tipoOrdem, global::System.Int32 estoqueSeguranca, global::System.DateTime dataCriacao, global::System.DateTime dataModificacao, global::System.Int32 leadTime, global::System.Int32 estoqueMinimo, global::System.Int32 loteReposicao)
 {
     Material material = new Material();
     material.Id = id;
     material.Codigo = codigo;
     material.Descricao = descricao;
     material.TipoReposicao = tipoReposicao;
     material.TipoOrdem = tipoOrdem;
     material.EstoqueSeguranca = estoqueSeguranca;
     material.DataCriacao = dataCriacao;
     material.DataModificacao = dataModificacao;
     material.LeadTime = leadTime;
     material.EstoqueMinimo = estoqueMinimo;
     material.LoteReposicao = loteReposicao;
     return material;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Material EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMaterial(Material material)
 {
     base.AddObject("Material", material);
 }