Ejemplo n.º 1
0
    public void UpdatePlayerChampionships(Player player)
    {
        bool flag = false;
        foreach (Championship c in db.Championships)
        {
            foreach (PlayerToChampionship ctp in db.PlayerToChampionships)
            {
                if (c.Id == ctp.Championship_Id)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                PlayerToChampionship ptc = new PlayerToChampionship();
                ptc.Championship_Id = c.Id;
                ptc.Player_Id = player.Id;
                db.PlayerToChampionships.InsertOnSubmit(ptc);
                db.SubmitChanges();
            }

        }
    }
Ejemplo n.º 2
0
    public void AddPlayerToChamp(Player player, int champId)
    {
        var x =
            (from p in db.PlayerToChampionships
            where p.Player_Id == player.Id && p.Championship_Id == champId
            select p).SingleOrDefault();

        if(x == null)
        {
            PlayerToChampionship playerToChamp = new PlayerToChampionship();
            int id = Convert.ToInt32(x);
            playerToChamp.Player_Id = player.Id;
            playerToChamp.Championship_Id = champId;
            db.PlayerToChampionships.InsertOnSubmit(playerToChamp);
            db.SubmitChanges();
        }
    }
Ejemplo n.º 3
0
 partial void UpdatePlayerToChampionship(PlayerToChampionship instance);
Ejemplo n.º 4
0
 partial void DeletePlayerToChampionship(PlayerToChampionship instance);
Ejemplo n.º 5
0
 partial void InsertPlayerToChampionship(PlayerToChampionship instance);