public ActionResult Edit(MonitorBeurtModel monitorbeurtmodel, int CampusId) { if (ModelState.IsValid) { var CampusList = db.Campus.ToList().Where(campus => campus.Id == CampusId); monitorbeurtmodel.Campus = CampusList.First(); monitorbeurtmodel.Duurtijd = "50"; db.Entry(monitorbeurtmodel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(monitorbeurtmodel); }
public ActionResult Create(MonitorBeurtModel monitorbeurtmodel, int CampusId) { if (ModelState.IsValid) { var CampusList = db.Campus.ToList().Where(campus => campus.Id == CampusId); monitorbeurtmodel.Campus = CampusList.First(); db.MonitorBeurt.Add(monitorbeurtmodel); db.SaveChanges(); return RedirectToAction("Index"); } return View(monitorbeurtmodel); }