public ActionResult Create(GolfCourse golfcourse) { if (ModelState.IsValid) { db.GolfCourses.Add(golfcourse); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.GolfClubID = new SelectList(db.GolfClubs, "GolfClubID", "Name", golfcourse.GolfClubID); return View(golfcourse); }
public ActionResult Edit(GolfCourse golfcourse) { if (ModelState.IsValid) { db.Entry(golfcourse).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.GolfClubID = new SelectList(db.GolfClubs, "GolfClubID", "Name", golfcourse.GolfClubID); return View(golfcourse); }