public async Task <IActionResult> Create([Bind("GradeId,GradeName,AgeGrade")] Grade grade)
        {
            if (ModelState.IsValid)
            {
                _context.Add(grade);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(grade));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("TeamId,TeamName,Age,Phone")] Teams teams)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teams);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(teams));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("EnrolId,TeamId,GradeId")] Enrolment enrolment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enrolment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GradeId"] = new SelectList(_context.Grade, "GradeId", "GradeId", enrolment.GradeId);
            ViewData["TeamId"]  = new SelectList(_context.Teams, "TeamId", "TeamId", enrolment.TeamId);
            return(View(enrolment));
        }