示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ContestEnrollment contestenrollment = db.ContestEnrollments.Find(id);

            db.ContestEnrollments.Remove(contestenrollment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 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));
 }
示例#3
0
        // 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));
        }
示例#4
0
        // 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));
        }
示例#5
0
        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));
        }