Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            HExtras hExtras = db.HExtras.Find(id);

            db.HExtras.Remove(hExtras);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "IdExtras,Cantidad,IdEmpleado, TotalSalario")] HExtras hExtras)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hExtras).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdEmpleado = new SelectList(db.Empleado, "IdEmpleado", "Nombre", hExtras.IdEmpleado);
     return(View(hExtras));
 }
Esempio n. 3
0
        // GET: HExtras/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HExtras hExtras = db.HExtras.Find(id);

            if (hExtras == null)
            {
                return(HttpNotFound());
            }
            return(View(hExtras));
        }
Esempio n. 4
0
        // GET: HExtras/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HExtras hExtras = db.HExtras.Find(id);

            if (hExtras == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdEmpleado = new SelectList(db.Empleado, "IdEmpleado", "Nombre", hExtras.IdEmpleado);
            return(View(hExtras));
        }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "IdExtras,Cantidad,IdEmpleado, TotalSalario")] HExtras hExtras)
        {
            if (ModelState.IsValid)
            {
                db.HExtras.Add(hExtras);
                db.SaveChanges();


                double horas = hExtras.Cantidad;

                if (horas == 3)
                {
                    hExtras.TotalSalario = horas * 3;
                }
                if (horas > 6)
                {
                    hExtras.TotalSalario = horas * 6;
                }
                else
                {
                    ViewBag.error = "Error";
                }

                db.Entry(hExtras).State = EntityState.Modified;
                db.SaveChanges();

                //var Sal = (from p in db.Empleado where p.IdEmpleado == hExtras.IdEmpleado select p).FirstOrDefault();
                //double Pago = Sal.Salario;
                //double PagooHoras = hExtras.TotalSalario;

                //hExtras.TotalSalario = Pago + PagooHoras;
                //db.Entry(hExtras).State = EntityState.Modified;
                //db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            ViewBag.IdEmpleado = new SelectList(db.Empleado, "IdEmpleado", "Nombre", hExtras.IdEmpleado);
            return(View(hExtras));
        }