public async Task <IActionResult> Edit(string id, [Bind("GradeId,GradeName,AgeGrade")] Grade grade)
        {
            if (id != grade.GradeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grade);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GradeExists(grade.GradeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(grade));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("EnrolId,TeamId,GradeId")] Enrolment enrolment)
        {
            if (id != enrolment.EnrolId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enrolment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnrolmentExists(enrolment.EnrolId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("TeamId,TeamName,Age,Phone")] Teams teams)
        {
            if (id != teams.TeamId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teams);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamsExists(teams.TeamId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(teams));
        }