public ActionResult DeleteConfirmed(int id)
        {
            GastoEnergia gastoEnergia = db.GastoEnergia.Find(id);

            db.GastoEnergia.Remove(gastoEnergia);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: GastoEnergia/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GastoEnergia gastoEnergia = db.GastoEnergia.Find(id);

            if (gastoEnergia == null)
            {
                return(HttpNotFound());
            }
            return(View(gastoEnergia));
        }
 public ActionResult Create(GastoEnergia gastoEnergia)
 {
     try
     {
         gastoEnergia.FechaCreacion = System.DateTime.Now;
         db.GastoEnergia.Add(gastoEnergia);
         db.SaveChanges();
         return(Json(new { Message = clsReferencias.Exito }));
     }
     catch (Exception ex)
     {
         return(Json(new { Message = new clsException(ex).Message() }));
     }
 }
        public ActionResult Edit(GastoEnergia gastoEnergia)
        {
            try
            {
                GastoEnergia ge = db.GastoEnergia.Find(gastoEnergia.IdGastoEnergia);
                ge.MesAplica = gastoEnergia.MesAplica;
                ge.Monto     = gastoEnergia.Monto;
                ge.FacturaNo = gastoEnergia.FacturaNo;

                db.Entry(ge).State = EntityState.Modified;
                db.SaveChanges();
                return(Json(new { Message = clsReferencias.Exito }));
            }
            catch (Exception ex)
            {
                return(Json(new { Message = new clsException(ex).Message() }));
            }
        }