public ActionResult DeleteConfirmed(int id) { Golfcourse golfcourse = db.Golfcourses.Find(id); db.Golfcourses.Remove(golfcourse); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Country")] Golfcourse golfcourse) { if (ModelState.IsValid) { db.Entry(golfcourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(golfcourse)); }
public ActionResult Create([Bind(Include = "Id,Name,Country")] Golfcourse golfcourse) { if (ModelState.IsValid) { db.Golfcourses.Add(golfcourse); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(golfcourse)); }
// GET: Golfcourse/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Golfcourse golfcourse = db.Golfcourses.Find(id); if (golfcourse == null) { return(HttpNotFound()); } return(View(golfcourse)); }