public async Task <IActionResult> Create([Bind("Id,FullName,Dorsal,DoB")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(player));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Dorsal,DoB,SoccerPositionId")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SoccerPositionId"] = new SelectList(_context.SoccerPosition, "Id", "Code", player.SoccerPositionId);
            return(View(player));
        }