public ActionResult DeleteConfirmed(int id) { ContestEnrollment contestenrollment = db.ContestEnrollments.Find(id); db.ContestEnrollments.Remove(contestenrollment); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,ContestID,PlayerID,EnrollmentDate")] ContestEnrollment contestenrollment) { if (ModelState.IsValid) { db.Entry(contestenrollment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlayerID = new SelectList(db.Players, "ID", "ID", contestenrollment.PlayerID); return(View(contestenrollment)); }
// GET: /ContestEnrollment/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContestEnrollment contestenrollment = db.ContestEnrollments.Find(id); if (contestenrollment == null) { return(HttpNotFound()); } return(View(contestenrollment)); }
// GET: /ContestEnrollment/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContestEnrollment contestenrollment = db.ContestEnrollments.Find(id); if (contestenrollment == null) { return(HttpNotFound()); } ViewBag.PlayerID = new SelectList(db.Players, "ID", "ID", contestenrollment.PlayerID); ViewBag.ContestID = new SelectList(db.Contests, "ID", "Name"); return(View(contestenrollment)); }
public ActionResult Create([Bind(Include = "ID,ContestID,PlayerID,EnrollmentDate")] ContestEnrollment contestenrollment) { var currentUser = manager.FindById(User.Identity.GetUserId()); if (ModelState.IsValid) { //contestenrollment.Player.User = currentUser; contestenrollment.PlayerID = currentUser.Player.ID; contestenrollment.EnrollmentDate = DateTime.Now; db.ContestEnrollments.Add(contestenrollment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlayerID = new SelectList(db.Players, "ID", "ID", contestenrollment.PlayerID); return(View(contestenrollment)); }