public ActionResult Edit(MateriasView materias) { try { db.update(materias); return RedirectToAction("Index"); } catch { return View(); } }
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); }
public ActionResult Index() { MateriasView materias = new MateriasView(); materias.materias = db.getMaterias(); return View(materias); }
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"); }
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; } }