Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Fecha,Difficult")] Match match)
        {
            if (ModelState.IsValid)
            {
                _context.Add(match);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(match));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Mail,Username")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(player));
        }
        public async Task <IActionResult> Create([Bind("Id,GameId,PlayerId")] GameStuff gameStuff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(gameStuff);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlayerId"] = new SelectList(_context.Set <Player>(), "Id", "Id", gameStuff.PlayerId);
            return(View(gameStuff));
        }