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)); }
public async Task <IActionResult> Create([Bind("Id,AthleteId,EventId,Result")] RaceMemberResult raceMemberResult) { if (ModelState.IsValid) { _context.Add(raceMemberResult); await _context.SaveChangesAsync(); 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)); }