Example #1
0
 public ActionResult Create(Gastos gasto)
 {
     if (ModelState.IsValid)
     {
         db.Gastos.AddObject(gasto);
         db.SaveChanges();
         return View("index", db.Gastos.ToList());
     }
     return PartialView(gasto);
 }
Example #2
0
        public ActionResult Edit(Gastos gasto)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(gasto).State = EntityState.Modified;
                db.Gastos.Attach(gasto);
                db.ObjectStateManager.ChangeObjectState(gasto, EntityState.Modified);

                db.SaveChanges();
                return View("index", db.Gastos.ToList());
            }
            return PartialView(gasto);
        }
Example #3
0
 /// <summary>
 /// Método desusado para agregar un nuevo objeto al EntitySet Gastos. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet&lt;T&gt; asociada.
 /// </summary>
 public void AddToGastos(Gastos gastos)
 {
     base.AddObject("Gastos", gastos);
 }
Example #4
0
 /// <summary>
 /// Crear un nuevo objeto Gastos.
 /// </summary>
 /// <param name="gastosID">Valor inicial de la propiedad GastosID.</param>
 /// <param name="fecha">Valor inicial de la propiedad Fecha.</param>
 public static Gastos CreateGastos(global::System.Int32 gastosID, global::System.DateTime fecha)
 {
     Gastos gastos = new Gastos();
     gastos.GastosID = gastosID;
     gastos.Fecha = fecha;
     return gastos;
 }