Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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);
 }