Exemple #1
0
        protected void ValidateUser(object sender, EventArgs e)
        {
            try
            {
                db = new ClubFootEntities();
                Users u = new Users();
                u.nom         = name.Text;
                u.prenom      = surname.Text;
                u.id_Statut   = 1;
                u.id_Club     = 1;
                u.identifiant = identifiant.Text;
                u.password    = password.Text;

                db.Users.Add(u);
                db.SaveChanges();
                messageValidateOK.InnerHtml           = "<p>Le joueur a bien été créé</p></br><a href ='#'>redirection</a>";
                messageValidateOK.Attributes["class"] = "visible alert alert-success";
            }
            catch (Exception error)
            {
                messageValidateOK.InnerHtml           = "Erreur au moment de la création du joueur";
                messageValidateOK.Attributes["class"] = "visible alert alert-success";
                Console.WriteLine(error.Message);
            }
        }
        protected void addEntrainement_Click(object sender, EventArgs e)
        {
            Entrainement entrainement = new Entrainement();

            entrainement.type = typeEntrainement.Text;
            entrainement.date = Convert.ToDateTime(dateEntrainement.Text + " " + heureEntrainement.Text);
            entities.Entrainement.Add(entrainement);


            EntrainementClubTerrain entrainementClubTerrain = new EntrainementClubTerrain();

            entrainementClubTerrain.Club         = userConnected.Club;
            entrainementClubTerrain.Entrainement = entrainement;
            entrainementClubTerrain.id_Terrain   = Int32.Parse(ListTerrainEntrainement.SelectedValue);
            entities.EntrainementClubTerrain.Add(entrainementClubTerrain);

            entities.SaveChanges();
        }
 /// <summary>
 /// Save changes into the database
 /// </summary>
 protected void saveChanges()
 {
     entities.SaveChanges();
 }