Exemple #1
0
 public ActionResult Create([Bind(Include = "Numero_Identificacion,Nombres,Apellidos,Id_Ficha,Telefono,Correo,Id_Empresa")] Tbl_Aprendices tbl_Aprendices)
 {
     if (ModelState.IsValid && tbl_Aprendices.Nombres != null && tbl_Aprendices.Apellidos != null && tbl_Aprendices.Telefono != null && tbl_Aprendices.Correo != null)
     {
         db.Tbl_Aprendices.Add(tbl_Aprendices);
         db.SaveChanges();
         return(RedirectToAction("Create", "Tbl_Empresas", new { Id_Aprendiz = tbl_Aprendices.Numero_Identificacion }));
     }
     ViewBag.Id_Ficha = new SelectList(db.Tbl_Fichas, "Id_Ficha", "Numero_Ficha", tbl_Aprendices.Id_Ficha);
     return(View(tbl_Aprendices));
 }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Numero_Identificacion,Nombres,Apellidos,Id_Ficha,Telefono,Correo,Id_Centro,Id_Empresa")] Tbl_Aprendices tbl_Aprendices)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_Aprendices).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { ficha = tbl_Aprendices.Id_Ficha }));
     }
     ViewBag.Id_Ficha = new SelectList(db.Tbl_Fichas, "Id_Ficha", "Numero_Ficha", tbl_Aprendices.Id_Ficha);
     return(View(tbl_Aprendices));
 }
Exemple #3
0
        // GET: Tbl_Aprendices/Edit/5
        /// <summary>
        /// Se valida mediante la variable de Session["Rol"] que el usuario tenga permiso
        /// Se crea un ViewBag que posteriormente sera un DropDownList en la vista
        /// </summary>
        /// <param name="id">Resive el id que contiene la informacion del registro a editar</param>
        /// <returns>El modelo con la informacion correspondiente al id</returns>
        public ActionResult Edit(int?id)
        {
            if (Session["Rol"].ToString() == "3")
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tbl_Aprendices tbl_Aprendices = db.Tbl_Aprendices.Find(id);

            if (tbl_Aprendices == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id_Ficha = new SelectList(db.Tbl_Fichas, "Id_Ficha", "Numero_Ficha");
            return(View(tbl_Aprendices));
        }
Exemple #4
0
        // GET: Tbl_Aprendices/Details/5
        /// <summary>
        /// Se valida mediante la variable de Session["Rol"] que el usuario tenga permiso
        /// Se crea un ViewBag que posteriormente sera un DropDownList en la vista
        /// </summary>
        /// <param name="id">Resive el id que contiene la informacion del registro</param>
        /// <returns>la vista con el modelo que contiene la informacion correspondiente al id</returns>
        public ActionResult Details(int?id, int etapa)
        {
            if (Session["Rol"].ToString() == "3")
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tbl_Aprendices tbl_Aprendices = db.Tbl_Aprendices.Find(id);

            if (tbl_Aprendices == null)
            {
                return(HttpNotFound());
            }

            ViewBag.etapa = etapa;
            return(View(tbl_Aprendices));
        }