public void AjouterAuPoule(infoJoueur j, int idPoule) { List <infoJoueur> lJoueur = new infoJoueur().GetListJoueur(idPoule); int cpt = 1; foreach (infoJoueur joueur in lJoueur) { if (j.matchGagné - j.matchPerdu > joueur.matchGagné - joueur.matchPerdu) { joueur.position++; } else { cpt++; } } j.position = cpt; DCJoueur dc = new DCJoueur(); foreach (infoJoueur joueur in lJoueur) { dc.UpdateLD(joueur, idPoule); } dc.InsertLD(j, idPoule); }
public ActionResult AjoutJoueurPoule(int?joueur, int pos, int matchg, int matchp) { infoJoueur j = new infoJoueur { position = pos, matchGagné = matchg, matchPerdu = matchp, Id = Convert.ToInt32(joueur) }; DCJoueur dc = new DCJoueur(); dc.InsertLD(j, (int)Session["idPoule"]); Session["idPoule"] = null; return(Redirect("~/Competition/InfoComp/" + Session["idC"])); }