Beispiel #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Match).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MatchExists(Match.MatchId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Team.Add(Team);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            League = await _context.League.FindAsync(id);

            if (League != null)
            {
                if (League.Fixtures != null)
                {
                    var fixtures = _context.Fixture.Where(f => f.LeagueId == League.LeagueId);
                    foreach (var fixture in fixtures)
                    {
                        var matches = _context.Match.Where(m => m.FixtureId == fixture.FixtureId);
                        foreach (var match in matches)
                        {
                            var results = _context.GameResult.Where(gr => gr.MatchId == match.MatchId);
                            foreach (var result in results)
                            {
                                _context.GameResult.Remove(result);
                            }
                            var slots = _context.MatchSlot.Where(ms => ms.MatchId == match.MatchId);
                            foreach (var solt in slots)
                            {
                                _context.MatchSlot.Remove(solt);
                            }
                            _context.Match.Remove(match);
                        }
                        _context.Fixture.Remove(fixture);
                    }
                }
                _context.League.Remove(League);
                try
                {
                    await _context.SaveChangesAsync();
                }
                catch
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            FixtureDate = await _context.FixtureDate.FindAsync(id);

            if (FixtureDate != null)
            {
                _context.FixtureDate.Remove(FixtureDate);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MatchSlot = await _context.MatchSlot.FindAsync(id);

            if (MatchSlot != null)
            {
                _context.MatchSlot.Remove(MatchSlot);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TeamPlayer = await _context.TeamPlayer.FindAsync(id);

            if (TeamPlayer != null)
            {
                _context.TeamPlayer.Remove(TeamPlayer);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }