public ActionResult Edit(Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Clientes.Attach(cliente);
         db.ObjectStateManager.ChangeObjectState(cliente, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(cliente);
 }
        public ActionResult Create(Cliente cliente)
        {
            if (ModelState.IsValid)
            {
                db.Clientes.AddObject(cliente);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(cliente);
        }
Пример #3
0
 /// <summary>
 /// Create a new Cliente object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="nome">Initial value of the nome property.</param>
 public static Cliente CreateCliente(global::System.Decimal id, global::System.String nome)
 {
     Cliente cliente = new Cliente();
     cliente.id = id;
     cliente.nome = nome;
     return cliente;
 }
Пример #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Clientes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToClientes(Cliente cliente)
 {
     base.AddObject("Clientes", cliente);
 }