예제 #1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (var context = new TableTennisDBContext())
            {
                var player2 = context.Player.Include(q => q.GamePlayer2).SingleOrDefault(q => q.Id == id);
                foreach (var child1 in player2.GamePlayer2.ToList())
                {
                    context.Game.Remove(child1);
                }
                var player1 = context.Player.Include(q => q.GamePlayer1).SingleOrDefault(q => q.Id == id);
                foreach (var child1 in player1.GamePlayer1.ToList())
                {
                    context.Game.Remove(child1);
                }
                var player3 = context.Player.Include(q => q.PlayerRackets).SingleOrDefault(q => q.Id == id);
                foreach (var child1 in player3.PlayerRackets.ToList())
                {
                    context.PlayerRackets.Remove(child1);
                }
                context.SaveChanges();
            }
            var player = await _context.Player.FindAsync(id);

            _context.Player.Remove(player);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
예제 #2
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (var context = new TableTennisDBContext())
            {
                var rubber1 = context.Rubber.Include(r => r.RacketBhrubber).SingleOrDefault(r => r.Id == id);
                foreach (var child2 in rubber1.RacketBhrubber.ToList())
                {
                    var racket = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == child2.Id);
                    // TODO remove player rackets?
                    var child3 = racket.PlayerRackets;
                    context.PlayerRackets.Remove(child3);
                    context.Racket.Remove(child2);
                }
                var rubber2 = context.Rubber.Include(r => r.RacketFhrubber).SingleOrDefault(r => r.Id == id);
                foreach (var child2 in rubber2.RacketFhrubber.ToList())
                {
                    var racket = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == child2.Id);
                    // TODO remove player rackets?
                    var child3 = racket.PlayerRackets;
                    context.PlayerRackets.Remove(child3);
                    context.Racket.Remove(child2);
                }
                context.SaveChanges();
            }
            var rubber = await _context.Rubber.FindAsync(id);

            _context.Rubber.Remove(rubber);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
예제 #3
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (var context = new TableTennisDBContext())
            {
                var rackets = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == id);
                var child3  = rackets.PlayerRackets;

                context.PlayerRackets.Remove(child3);
                context.SaveChanges();
            }
            var racket = await _context.Racket.FindAsync(id);

            _context.Racket.Remove(racket);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
예제 #4
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (var context = new TableTennisDBContext())
            {
                var blade1 = context.Blade.Include(b => b.Racket).SingleOrDefault(b => b.Id == id);
                foreach (var child2 in blade1.Racket.ToList())
                {
                    var racket = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == child2.Id);
                    var child3 = racket.PlayerRackets;
                    context.PlayerRackets.Remove(child3);
                    context.Racket.Remove(child2);
                }
                context.SaveChanges();
            }
            var blade = await _context.Blade.FindAsync(id);

            _context.Blade.Remove(blade);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
 public PlayerRacketsController(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #6
0
 public AllFactoriesController(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #7
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            using (var context = new TableTennisDBContext())
            {
                var factory1 = context.Factory.Include(f => f.Blade).SingleOrDefault(f => f.Id == id);
                foreach (var child1 in factory1.Blade.ToList())
                {
                    var blade = context.Blade.Include(b => b.Racket).SingleOrDefault(b => b.Id == child1.Id);
                    foreach (var child2 in blade.Racket.ToList())
                    {
                        var racket = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == child2.Id);
                        var child3 = racket.PlayerRackets;
                        context.PlayerRackets.Remove(child3);
                        context.Racket.Remove(child2);
                    }
                    context.Blade.Remove(child1);
                }
                var factory2 = context.Factory.Include(f => f.Rubber).SingleOrDefault(f => f.Id == id);
                foreach (var child1 in factory1.Rubber.ToList())
                {
                    var rubber1 = context.Rubber.Include(r => r.RacketBhrubber).SingleOrDefault(r => r.Id == child1.Id);
                    foreach (var child2 in rubber1.RacketBhrubber.ToList())
                    {
                        var racket = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == child2.Id);

                        var child3 = racket.PlayerRackets;
                        foreach (var child4 in child3.GameRacket1.ToList())
                        {
                            context.Game.Remove(child4);
                        }
                        foreach (var child4 in child3.GameRacket2.ToList())
                        {
                            context.Game.Remove(child4);
                        }
                        context.PlayerRackets.Remove(child3);
                        context.Racket.Remove(child2);
                    }
                    var rubber2 = context.Rubber.Include(r => r.RacketFhrubber).SingleOrDefault(r => r.Id == child1.Id);
                    foreach (var child2 in rubber2.RacketFhrubber.ToList())
                    {
                        var racket = context.Racket.Include(w => w.PlayerRackets).SingleOrDefault(w => w.Id == child2.Id);

                        var child3 = racket.PlayerRackets;
                        foreach (var child4 in child3.GameRacket1.ToList())
                        {
                            context.Game.Remove(child4);
                        }
                        foreach (var child4 in child3.GameRacket2.ToList())
                        {
                            context.Game.Remove(child4);
                        }
                        context.PlayerRackets.Remove(child3);
                        context.Racket.Remove(child2);
                    }
                    context.Rubber.Remove(child1);
                }
                context.SaveChanges();
            }
            var factory = await _context.Factory.FindAsync(id);

            _context.Factory.Remove(factory);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
예제 #8
0
 public Players1Controller(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #9
0
 public CountriesController(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #10
0
 public AllGamesController(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #11
0
 public ChartsController(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #12
0
 public AllRubbersController(TableTennisDBContext context)
 {
     _context = context;
 }
예제 #13
0
 public RubbersChartController(TableTennisDBContext context)
 {
     _context = context;
 }