public async Task <IActionResult> Edit(int id, [Bind("CaptainID,FirstName,LastName,StartDate")] Captain captain) { if (id != captain.CaptainID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(captain); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CaptainExists(captain.CaptainID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(captain)); }
public async Task <IActionResult> Edit(int id, [Bind("TeamID,CaptainID,TeamName")] Team team) { if (id != team.TeamID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(team); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(team.TeamID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CaptainID"] = new SelectList(_context.Captains, "CaptainID", "CaptainID", team.CaptainID); return(View(team)); }