예제 #1
0
 public ActionResult Edit(MateriasView materias)
 {
     try
     {
         db.update(materias);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
예제 #2
0
 public ActionResult Edit(int id)
 {
     matter materia = db.getMateria(id);
     MateriasView vistaMaterias = new MateriasView()
     {
         id = materia.id,
         name = materia.name,
         code = materia.code
     };
     vistaMaterias.materias = db.getMaterias();
     return View(vistaMaterias);
 }
예제 #3
0
        public ActionResult Index()
        {
            MateriasView materias = new MateriasView();
            materias.materias = db.getMaterias();

            return View(materias);
        }
예제 #4
0
 public ActionResult Index(MateriasView materia)
 {
     matter mat = new matter()
     {
         code = materia.code,
         date_register = DateTime.Now,
         name = materia.name,
     };
     db.save(mat);
     return RedirectToAction("Index");
 }
예제 #5
0
 public bool update(MateriasView materias)
 {
     try
     {
         matter mat = getMateria(materias.id);
         mat.name = materias.name;
         mat.code = materias.code;
         contexto.SaveChanges();
         return true;
     }
     catch {
         return false;
     }
 }