public async Task <IActionResult> Edit(int id, [Bind("FixtureID,PlayerID,GoalsScoredID")] PlayerFixtures playerFixtures) { if (id != playerFixtures.FixtureID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(playerFixtures); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerFixturesExists(playerFixtures.FixtureID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FixtureID"] = new SelectList(_context.Fixtures, "FixtureID", "FixtureID", playerFixtures.FixtureID); ViewData["PlayerID"] = new SelectList(_context.Players, "PlayerID", "PlayerID", playerFixtures.PlayerID); return(View(playerFixtures)); }
public async Task <IActionResult> Create([Bind("FixtureID,PlayerID,GoalsScoredID")] PlayerFixtures playerFixtures) { if (ModelState.IsValid) { _context.Add(playerFixtures); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FixtureID"] = new SelectList(_context.Fixtures, "FixtureID", "FixtureID", playerFixtures.FixtureID); ViewData["PlayerID"] = new SelectList(_context.Players, "PlayerID", "PlayerID", playerFixtures.PlayerID); return(View(playerFixtures)); }