public async Task <IActionResult> Edit(int id, [Bind("ID,TeamName,Points,Wins,Draws,Losses,GoalsFor,GoalsAgainst,GoalDifference")] Team team)
        {
            if (id != team.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(team);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(team.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Edit(Position id, [Bind("Position,Appearance,GoalScored,CleanSheet,Assist,ConceedOnePlus,ConceedThreePlus,ConceedFivePlus,PenSave,PenMiss,MOTM,YellowCard,RedCard")] Scoring scoring)
        {
            if (id != scoring.Position)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(scoring);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ScoringExists(scoring.Position))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(scoring));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,PlayerID,MatchID,Position,Appearance,Goals,CleanSheet,Assists,GoalsConceeded,PenaltiesSaved,PenaltiesMissed,MOTM,YellowCard,RedCard,Paid,Substitute")] Performance performance)
        {
            if (id != performance.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ScoreCalculator.CalculateTotal(performance, _context);
                    _context.Update(performance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PerformanceExists(performance.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,NickName,Number,DefaultPosition")] Player player)
        {
            if (id != player.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(player);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlayerExists(player.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(player));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Date,PlayedAtHome,OpositionID,HomeScore,AwayScore,Competition")] Match match)
        {
            if (id != match.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(match);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatchExists(match.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OpositionID"] = new SelectList(_context.Teams, "ID", "ID", match.OpositionID);
            return(View(match));
        }