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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(player));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Dorsal,DoB,EmailPlayer,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));
        }