public ActionResult Create(Venda venda)
        {
            if (ModelState.IsValid)
            {

                Session["Venda"] = venda;
                RedirectToAction("Index", "VendaProduto");

                //db.Vendas.AddObject(venda);
                //db.SaveChanges();
                //return RedirectToAction("Index");
            }

            ViewBag.id_cliente = new SelectList(db.Clientes, "id", "nome", venda.id_cliente);
            return View(venda);
        }
 /// <summary>
 /// Create a new Venda object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="data_venda">Initial value of the data_venda property.</param>
 /// <param name="valor_venda">Initial value of the valor_venda property.</param>
 public static Venda CreateVenda(global::System.Decimal id, global::System.DateTime data_venda, global::System.Decimal valor_venda)
 {
     Venda venda = new Venda();
     venda.id = id;
     venda.data_venda = data_venda;
     venda.valor_venda = valor_venda;
     return venda;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Vendas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVendas(Venda venda)
 {
     base.AddObject("Vendas", venda);
 }
        public ActionResult Edit(Venda venda)
        {
            if (ModelState.IsValid)
            {
                //db.Vendas.Attach(venda);
                //db.ObjectStateManager.ChangeObjectState(venda, EntityState.Modified);

                ///*--------------------------------------*/
                Session["Venda"] = venda;
                return RedirectToAction("Index", "VendaProduto");
                ///*--------------------------------------*/

                //db.SaveChanges();
                //return RedirectToAction("Index");
            }
            ViewBag.id_cliente = new SelectList(db.Clientes, "id", "nome", venda.id_cliente);
            return View(venda);
        }