Esempio n. 1
0
        public JsonResult SaveEvent(horario_laboral e, int?Subempcar_id)
        {
            var status = false;

            if (e.Hl_Id > 0)
            {
                //Update
                var v = db.horario_laboral.Where(a => a.Hl_Id == e.Hl_Id).FirstOrDefault();
                if (v != null)
                {
                    v.Hl_Titulo      = e.Hl_Titulo;
                    v.Hl_Inicio      = e.Hl_Inicio;
                    v.Hl_Termino     = e.Hl_Termino;
                    v.Hl_Descripcion = e.Hl_Descripcion;
                    v.Hl_TodoDia     = e.Hl_TodoDia;
                    v.Hl_ColorTema   = e.Hl_ColorTema;
                }
            }
            else
            {
                e.Subempcar_id = Subempcar_id;
                db.horario_laboral.Add(e);
            }
            db.SaveChanges();
            status = true;

            return(new JsonResult {
                Data = new { status }
            });
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            horario_laboral horario_laboral = db.horario_laboral.Find(id);

            db.horario_laboral.Remove(horario_laboral);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Hl_Id,Car_Id,Ds_Id,Hl_Inicio,Hl_Termino")] horario_laboral horario_laboral)
 {
     if (ModelState.IsValid)
     {
         db.Entry(horario_laboral).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Car_Id = new SelectList(db.cargos, "Car_Id", "Car_Nom", horario_laboral.Car_Id);
     ViewBag.Ds_Id  = new SelectList(db.diassemanales, "Ds_id", "Ds_Nom", horario_laboral.Ds_Id);
     return(View(horario_laboral));
 }
Esempio n. 4
0
        // GET: horario_laboral/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            horario_laboral horario_laboral = db.horario_laboral.Find(id);

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

            if (horario_laboral == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Car_Id = new SelectList(db.cargos, "Car_Id", "Car_Nom", horario_laboral.Car_Id);
            ViewBag.Ds_Id  = new SelectList(db.diassemanales, "Ds_id", "Ds_Nom", horario_laboral.Ds_Id);
            return(View(horario_laboral));
        }