示例#1
0
 public ActionResult Edit(Fabricante fabricante)
 {
     if (ModelState.IsValid)
     {
         context.Entry(fabricante).State = EntityState.Modified;
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fabricante));
 }
示例#2
0
 public void GravarProduto(Produto produto)
 {
     if (produto.ProdutoId == null)
     {
         context.Produtos.Add(produto);
     }
     else
     {
         context.Entry(produto).State =
             EntityState.Modified;
     }
     context.SaveChanges();
 }