Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AgeGroupName")] AgeGroup ageGroup)
        {
            if (id != ageGroup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ageGroup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AgeGroupExists(ageGroup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ageGroup));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,DistrictName")] District district)
        {
            if (id != district.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(district);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DistrictExists(district.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(district));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,StreetAddress,ZipCode,County,Country,Ssn,PhoneNumber1,PhoneNumber2,Email,ClubId,SportId,DistrictId,AgeGroupId,TeamId,SeasonId")] Person person)
        {
            if (id != person.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(person);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonExists(person.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AgeGroupId"] = new SelectList(_context.AgeGroup, "Id", "AgeGroupName", person.AgeGroupId);
            ViewData["ClubId"]     = new SelectList(_context.Club, "Id", "ClubName", person.ClubId);
            ViewData["DistrictId"] = new SelectList(_context.District, "Id", "DistrictName", person.DistrictId);
            ViewData["SeasonId"]   = new SelectList(_context.Set <Season>(), "Id", "SeasonName", person.SeasonId);
            ViewData["SportId"]    = new SelectList(_context.Sport, "Id", "SportName", person.SportId);
            ViewData["TeamId"]     = new SelectList(_context.Team, "Id", "TeamName", person.TeamId);
            return(View(person));
        }