public async Task <IActionResult> Create([Bind("Name,Id")] Player player) { if (ModelState.IsValid) { _context.Add(player); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(player)); }
public async Task <IActionResult> Create([Bind("PlayerId,CampaignId")] CampaignPlayer campaignPlayer) { if (ModelState.IsValid) { _context.Add(campaignPlayer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CampaignId"] = new SelectList(_context.Campaigns, "Id", "Id", campaignPlayer.CampaignId); ViewData["PlayerId"] = new SelectList(_context.Players, "Id", "Id", campaignPlayer.PlayerId); return(View(campaignPlayer)); }