Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Author,ReleaseDate")] Competition competition)
        {
            if (ModelState.IsValid)
            {
                _context.Add(competition);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(competition));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Salary,WorkExperience")] Trainer trainer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trainer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(trainer));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Position,TeamId")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Team, "Id", "Id", player.TeamId);
            return(View(player));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,Budget,TrainerId")] Team team)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TrainerId"] = new SelectList(_context.Trainer, "Id", "Id", team.TrainerId);
            return(View(team));
        }