Beispiel #1
0
        public void Guardar()
        {
            //var docente = new Docente();

            try
            {
                using (CDBContext db = new CDBContext())
                {
                    if (this.Code_Docente == 0)
                    {
                        db.Entry(this).State = EntityState.Added;
                        foreach (var m in this.Materias)
                        {
                            db.Entry(m).State = EntityState.Unchanged;
                        }
                    }
                    db.SaveChanges();
                }
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
 public ActionResult Edit([Bind(Include = "Code_Docente,Nombre_Docente")] Docente docente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(docente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(docente));
 }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "Id_materia,Descripcion")] Materia materia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(materia).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(materia));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Age")] MyFirstTable myFirstTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(myFirstTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(myFirstTable));
 }
 public ActionResult Edit([Bind(Include = "Code_Alumno,Nombres,Apellidos,Fecha_Nacimiento,DNI")] Alumno alumno)
 {
     if (ModelState.IsValid)
     {
         db.Entry(alumno).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(alumno));
 }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "Id_notas,Code_Alumno,Id_Materia,Nota1,Nota2")] Alumno_Materia alumno_Materia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(alumno_Materia).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Code_Alumno = new SelectList(db.Alumnoes, "Code_Alumno", "Nombres", alumno_Materia.Code_Alumno);
     ViewBag.Id_Materia  = new SelectList(db.Materias, "Id_materia", "Descripcion", alumno_Materia.Id_Materia);
     return(View(alumno_Materia));
 }
Beispiel #7
0
        public ActionResult Edit([Bind(Include = "ID,Name,Phone,Mail,Address,FechaNacimiento,GenderId")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(customer).State = EntityState.Modified;
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            SelectList lsGender = new SelectList(_db.genders, "genderId", "genderName");

            ViewBag.GenderList = lsGender;

            return(View(customer));
        }