// GET: Player
        public ActionResult AddPlayer(PlayerViewModel player)
        {
            if (player != null)
            {

                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    Player addPlayer = new Player
                    {
                        Name = player.Name,
                        PhoneNumber = player.PhoneNumber,
                        Email = player.Email

                    };

                    ctx.Player.Add(addPlayer);
                    ctx.SaveChanges();

                    if (player.Wednesday.Equals(true))
                    {
                        ctx.Players_GameType.Add(new Players_GameType
                        {
                            PlayerID = addPlayer.ID,
                            GameTypeID = 2,
                            IsSubstitute = true
                        });

                        ctx.SaveChanges();

                        if (player.Sunday.Equals(true))
                        {
                            ctx.Players_GameType.Add(new Players_GameType
                            {
                                PlayerID = addPlayer.ID,
                                GameTypeID = 1,
                                IsSubstitute = true
                            });

                            ctx.SaveChanges();
                        }

                        ctx.Dispose();
                    }
                }

            }
            return View();
        }
        public void AddPlayer(PlayerViewModel player)
        {
            int playerID;

            if (player != null)
            {
                using (ApplicationDbContext ctx = new ApplicationDbContext())
                {
                    Player addPlayer = new Player
                    {
                        Name = player.Name,
                        PhoneNumber = player.PhoneNumber,
                        Email = player.Email

                    };

                    ctx.Player.Add(addPlayer);
                    ctx.SaveChanges();

                    playerID = addPlayer.ID;

                    if (player.Wednesday.Equals(true))
                    {
                        ctx.Players_GameType.Add(new Players_GameType
                        {
                            PlayerID = playerID,
                            GameTypeID = 2,
                            IsSubstitute = true
                        });

                        ctx.SaveChanges();

                        var playerExistsInClassification = ctx.Classification.Include("GameType")
                            .Where(c => c.GameTypeID.Equals(2))
                            .Where(c => c.PlayerID.Equals(player.ID));

                        if (playerExistsInClassification.Equals(null) || playerExistsInClassification.Count().Equals(0))
                        {
                            ctx.Classification.Add(new Classification
                            {
                                PlayerID = playerID,
                                SettingsId = 1,
                                SeasonID = 1,
                                GameTypeID = 2

                            });

                        }

                        ctx.SaveChanges();
                    }

                    if (player.Sunday.Equals(true))
                    {
                        ctx.Players_GameType.Add(new Players_GameType
                        {
                            PlayerID = playerID,
                            GameTypeID = 1,
                            IsSubstitute = true
                        });

                        ctx.SaveChanges();

                        var playerExistsInClassification = ctx.Classification
                        .Where(c => c.GameTypeID.Equals(1))
                        .Where(c => c.PlayerID.Equals(playerID));

                        if (playerExistsInClassification.Equals(null) || playerExistsInClassification.Count().Equals(0))
                        {
                            ctx.Classification.Add(new Classification
                            {
                                PlayerID = playerID,
                                SettingsId = 1,
                                SeasonID = 1,
                                GameTypeID = 1

                            });

                            ctx.SaveChanges();

                        }

                    }

                    ctx.Dispose();

                }
            }
        }