예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DineroEnCaja dineroEnCaja = db.DineroEnCajas.Find(id);

            db.DineroEnCajas.Remove(dineroEnCaja);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "id,fecha,dinero")] DineroEnCaja dineroEnCaja)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dineroEnCaja).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dineroEnCaja));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "id,fecha,dinero")] DineroEnCaja dineroEnCaja)
        {
            if (ModelState.IsValid)
            {
                dineroEnCaja.fecha = DateTime.Now;
                db.DineroEnCajas.Add(dineroEnCaja);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dineroEnCaja));
        }
예제 #4
0
        // GET: DineroEnCaja/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DineroEnCaja dineroEnCaja = db.DineroEnCajas.Find(id);

            if (dineroEnCaja == null)
            {
                return(HttpNotFound());
            }
            return(View(dineroEnCaja));
        }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Gasto gasto = db.Gastoes.Find(id);

            int          dinero = dineroAcomulado();
            DineroEnCaja caja   = new DineroEnCaja();

            caja.fecha  = DateTime.Now;
            caja.dinero = dinero + gasto.valor;
            db.DineroEnCajas.Add(caja);
            db.Gastoes.Remove(gasto);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
        public ActionResult Create(Ingreso ingreso)
        {
            if (ModelState.IsValid)
            {
                int          dinero = dineroAcomulado();
                DineroEnCaja caja   = new DineroEnCaja();
                caja.fecha  = DateTime.Now;
                caja.dinero = dinero + ingreso.valor;
                db.DineroEnCajas.Add(caja);

                ingreso.fecha = DateTime.Now;

                db.Ingresoes.Add(ingreso);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.productofk = new SelectList(db.Productoes, "id", "nombre", ingreso.productofk);
            return(View(ingreso));
        }
예제 #7
0
        public ActionResult Create(Gasto gasto)
        {
            if (ModelState.IsValid)
            {
                int          dinero = dineroAcomulado();
                DineroEnCaja caja   = new DineroEnCaja();
                caja.fecha  = DateTime.Now;
                caja.dinero = dinero - gasto.valor;
                db.DineroEnCajas.Add(caja);


                gasto.fecha = DateTime.Now;

                db.Gastoes.Add(gasto);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.materialFK = new SelectList(db.Materials, "id", "nombre", gasto.materialFK);
            return(View(gasto));
        }