예제 #1
0
        public ActionResult Create([Bind(Include = "MeetID,Location,MeetDate")] Meet meet)
        {
            if (ModelState.IsValid)
            {
                db.Meets.Add(meet);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(meet));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "AthleteID,Name,Gender,TeamID")] Athlete athlete)
        {
            if (ModelState.IsValid)
            {
                db.Athletes.Add(athlete);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TeamID = new SelectList(db.Teams, "TeamID", "Name", athlete.TeamID);
            return(View(athlete));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "EARID,RaceTime,EventID,AthleteID,MeetID")] EventAthleteResult eventAthleteResult)
        {
            if (ModelState.IsValid)
            {
                db.EventAthleteResults.Add(eventAthleteResult);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            ViewBag.AthleteID = new SelectList(db.Athletes, "AthleteID", "Name", eventAthleteResult.AthleteID);
            ViewBag.EventID   = new SelectList(db.Events, "EventID", "Event1", eventAthleteResult.EventID);
            ViewBag.MeetID    = new SelectList(db.Meets, "MeetID", "Location", eventAthleteResult.MeetID);
            return(View(eventAthleteResult));
        }