partial void DeleteProfil(Profil instance);
 partial void InsertProfil(Profil instance);
 partial void UpdateProfil(Profil instance);
        public ProfilS CreateProfil(string name, string tokenId = "")
        {
            using (MasterDBDataContext db = new MasterDBDataContext())
            {
                Profil profil = null;
                profil = db.Profil.SingleOrDefault(p => p.Name == name);

                if (profil == null)
                {
                    if (tokenId == "")
                    {
                        Random random = new Random();
                        tokenId = random.Next().ToString();
                    }

                    profil = new Profil();
                    profil.Name = name;
                    profil.TokenId = tokenId;
                    profil.Avatar = "";
                    profil.Rank = 0;
                    db.Profil.InsertOnSubmit(profil);

                    try
                    {
                        db.SubmitChanges();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("ERROR CreateProfil " + ex.Message);
                        return null;
                    }
                }
                else
                {
                    profil = new Profil()
                    {
                        idProfil = -1,
                        Name = "",
                        Avatar = "",
                        Rank = 0,
                        TokenId = ""
                    };
                }

                return new ProfilS() {
                    id = profil.idProfil,
                    name = profil.Name,
                    avatar = profil.Avatar,
                    rank = profil.Rank,
                    tokenid = profil.TokenId
                };
            }
        }