Exemplo n.º 1
0
        // GET: Challenge/GroupDelete/5
        public ActionResult GroupDelete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GroupChallenge groupChallenge = db.GroupChallenges.Find(id);

            if (groupChallenge == null)
            {
                return(HttpNotFound());
            }
            return(View(groupChallenge));
        }
Exemplo n.º 2
0
        public ActionResult SelectedJoinGroupChallenge(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GroupChallenge challenge = db.GroupChallenges.Find(id);

            if (challenge == null)
            {
                return(HttpNotFound());
            }
            return(View(challenge));
        }
Exemplo n.º 3
0
        // GET: Challenge/GroupEdit/5
        public ActionResult GroupEdit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GroupChallenge groupChallenge = db.GroupChallenges.Find(id);

            if (groupChallenge == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GenderList    = getGenders();
            ViewBag.achievementID = new SelectList(db.Achievements, "achievementID", "achievementName", groupChallenge.achievementID);
            return(View(groupChallenge));
        }
Exemplo n.º 4
0
        public ActionResult CreateGroupChallenge([Bind(Include = "groupChallengeID,groupChallengeName,groupChallengeDescription,groupChallengeDistance,groupChallengeTimeStart,groupChallengeTimeEnd,groupChallengeGender,groupChallengeAgeLowerBound,groupChallengeAgeUpperBound,groupChallengeDegreeYear,groupChallengeDegreeFaculty,groupChallengeUserType,achievementID")] GroupChallenge challenge)
        {
            if (ModelState.IsValid)
            {
                //string sql = @"SELECT MAX(challengeID) FROM Challenge";
                //int max = db.Database.SqlQuery<int>(sql).Single();
                //challenge.challengeID = max + 1;

                db.GroupChallenges.Add(challenge);
                db.SaveChanges();
                return(RedirectToAction("ManageGroupChallenge"));
            }
            ViewBag.genderList    = getGenders();
            ViewBag.achievementID = new SelectList(db.Achievements, "achievementID", "achievementName", challenge.achievementID);
            return(View(challenge));
        }