public async Task <IActionResult> Create(Team team)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Create([Bind("Position,Appearance,GoalScored,CleanSheet,Assist,ConceedOnePlus,ConceedThreePlus,ConceedFivePlus,PenSave,PenMiss,MOTM,YellowCard,RedCard")] Scoring scoring)
        {
            if (ModelState.IsValid)
            {
                _context.Add(scoring);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(scoring));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,NickName,Number,DefaultPosition")] 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,Date,PlayedAtHome,OpositionID,HomeScore,AwayScore,Competition")] Match match)
        {
            if (ModelState.IsValid)
            {
                _context.Add(match);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OpositionID"] = new SelectList(_context.Teams, "ID", "ID", match.OpositionID);
            return(View(match));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create(Performance performance)
        {
            if (ModelState.IsValid)
            {
                ScoreCalculator.CalculateTotal(performance, _context);
                _context.Add(performance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), new { matchID = performance.MatchID }));
            }
            ViewData["MatchID"]  = new SelectList(_context.Matches, "ID", "ID", performance.MatchID);
            ViewData["PlayerID"] = new SelectList(_context.Players, "ID", "ID", performance.PlayerID);
            return(View(performance));
        }
Esempio n. 6
0
 public void Add(Number number)
 {
     _db.Add(number);
 }