public ActionResult DeleteConfirmed(int id) { Absenz course = unitOfWork.GetRepository <Absenz>().GetByID(id); unitOfWork.GetRepository <Absenz>().Delete(id); unitOfWork.Save(); return(RedirectToAction("Index")); }
// GET: /Absenz/Edit/ public ActionResult Edit(int id) { Absenz absenz = unitOfWork.GetRepository <Absenz>().GetByID(id); var module = unitOfWork.GetRepository <Modul>().Get(); var schueler = unitOfWork.GetRepository <Schueler>().Get(); ViewBag.modul_id = new SelectList(module, "modul_id", "Bezeichnung"); ViewBag.schueler_id = new SelectList(schueler, "schueler_id", "Nachname"); PopulateAbsenzDropDownList(absenz.absenz_id); return(View(absenz)); }
public ActionResult Create( [Bind(Include = "absenz_id,Datum,Lektionen,modul_id,schueler_id")] Absenz absenz) { try { if (ModelState.IsValid) { unitOfWork.GetRepository <Absenz>().Insert(absenz); unitOfWork.Save(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } PopulateAbsenzDropDownList(absenz.absenz_id); return(View(absenz)); }
public ActionResult Edit( [Bind(Include = "absenz_id,Datum,Lektionen,modul_id,schueler_id")] Absenz absenz) { try { if (ModelState.IsValid) { unitOfWork.GetRepository <Absenz>().Update(absenz); unitOfWork.Save(); return(RedirectToAction("Index")); } } catch (DataException /* dex */) { //Log the error (uncomment dex variable name after DataException and add a line here to write a log.) ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); } PopulateAbsenzDropDownList(absenz.absenz_id); return(View(absenz)); }
// GET: /Absenz/Details/5 public ViewResult Details(int id) { Absenz absenz = unitOfWork.GetRepository <Absenz>().GetByID(id); return(View(absenz)); }
// GET: /Absenz/Delete/ public ActionResult Delete(int id) { Absenz absenz = unitOfWork.GetRepository <Absenz>().GetByID(id); return(View(absenz)); }