public async Task <IActionResult> Create([Bind("PlayerId,PlayerName,Country,Team")] Playerstab playerstab) { if (ModelState.IsValid) { _context.Add(playerstab); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(playerstab)); }
public async Task <IActionResult> Create([Bind("CarId,Cost,Brand,Year,PlayerId")] Carstab carstab) { if (ModelState.IsValid) { _context.Add(carstab); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PlayerId"] = new SelectList(_context.Playerstab, "PlayerId", "PlayerId", carstab.PlayerId); return(View(carstab)); }