예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Location,Date,DistanceLength,DistanceMetric,CompetitionCode,TypeCode")] RunEvent runEvent)
        {
            if (id != runEvent.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(runEvent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RunEventExists(runEvent.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(runEvent));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AmNumber,Active")] ClubMember clubMember)
        {
            if (id != clubMember.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clubMember);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClubMemberExists(clubMember.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clubMember));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AthleteId,EventId,Result")] RaceMemberResult raceMemberResult)
        {
            if (id != raceMemberResult.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(raceMemberResult);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RaceMemberResultExists(raceMemberResult.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AthleteId"] = new SelectList(_context.ClubMember, "Id", "Id", raceMemberResult.AthleteId);
            ViewData["EventId"]   = new SelectList(_context.RunEvent, "Id", "CompetitionCode", raceMemberResult.EventId);
            return(View(raceMemberResult));
        }