public void ExectQuery(string query) { using (CohorisDB cdb = new CohorisDB(connection, false)) { cdb.Database.ExecuteSqlCommand(query); } }
public void AddPlayer(string name, bool Lead) { using (CohorisDB cdb = new CohorisDB(connection, false)) { cdb.Joueur.Add(new joueur() { NomJoueur = name, Lead = Lead }); cdb.SaveChanges(); } }
public void AddRole(string name) { using (CohorisDB cdb = new CohorisDB(connection, false)) { cdb.lRole.Add(new Role() { Nom = name }); cdb.SaveChanges(); } }
public void AddBuildJoue(int IDbuild, int IdJoueur) { using (CohorisDB cdb = new CohorisDB(connection, false)) { cdb.lBJouer.Add(new BuildJoue() { IDBuild = IDbuild, IDJoueur = IdJoueur }); cdb.SaveChanges(); } }
public void AddBuild(string name, string link, string nomcreateur, string classe, string role, bool valide,string description) { using (CohorisDB cdb = new CohorisDB(connection, false)) { cdb.lBuild.Add(new Build() { Nom = name, IDCreator = getPlayerId(nomcreateur), IDClasse = getClasseID(classe), IDRole = getRoleID(role), Validé = valide, Desctiption = description, Link = link }); cdb.SaveChanges(); } }
public List<Build> getBuild(string name) { using (CohorisDB cdb = new CohorisDB(connection, false)) { List<Build> res = new List<Build>(); if (name == null || name == "") { res = cdb.lBuild.ToList<Build>(); return res; } List<Build> l = cdb.lBuild.ToList<Build>(); int idplayer = getPlayerId(name); foreach (Build item in l) { if (item.IDCreator == idplayer) { res.Add(item); } } return res; } }
public int getRoleID(string name) { using (CohorisDB cdb = new CohorisDB(connection, false)) { List<Role> lc = cdb.lRole.ToList<Role>(); foreach (Role c in lc) { if (c.Nom == name) { return c.ID; } } return -1; } }
public joueur getPlayerByID(int ID) { joueur res = null; MySqlTransaction tr = connection.BeginTransaction(); using (CohorisDB cdb = new CohorisDB(connection, false)) { foreach (joueur item in cdb.Joueur) { if(item.IDJoueur == ID) { res = item; } } } return res; }
public List<joueur> getPlayer() { DbSet<joueur> res; MySqlTransaction tr = connection.BeginTransaction(); using (CohorisDB cdb = new CohorisDB(connection, false)) { res = cdb.Joueur; List<joueur> result = res.ToList<joueur>(); return result; } }