public ActionResult Nieuweschool(School school) { try { // TODO: Add insert logic here school.Naam = Request.Form["Naam"]; school.Adres = Request.Form["Adres"]; school.Huisnummer = Convert.ToInt32(Request.Form["Huisnummer"]); school.Postcode = Convert.ToInt32(Request.Form["Postcode"]); school.Gemeente = Request.Form["Gemeente"]; if (Request.Form["LogoUrl"] != null) { school.LogoUrl = Request.Form["LogoUrl"]; } superuserservice.Voegschooltoe(school); return RedirectToAction("Dashboard"); } catch { return View(); } }
public School Voegschooltoe(School school) { SchoolRepository.Insert(school); uow.SaveChanges(); return school; }
public ActionResult Wijzigschool(School school) { try { // TODO: Add update logic here if (ModelState.IsValid) { superuserservice.Updateschool(school); return RedirectToAction("Dashboard"); } } catch { ModelState.AddModelError(string.Empty, "Onmogelijk om gegevens op te slaan. Als het probleem blijft bestaan, contacteer de administrator."); } return View(school); }
public School Updateschool(School school) { SchoolRepository.Update(school); uow.SaveChanges(); return school; }