public Categorie_Matriel RechercheParId(int id)
        {
            Categorie_Matriel s = db.CMatriels
                                  .Where(i => i.id == id)
                                  .SingleOrDefault();

            return(s);
        }
        public bool Update(Categorie_Matriel s)
        {
            var original = db.CMatriels.Find(s.id);

            if (original != null)
            {
                db.Entry(original).CurrentValues.SetValues(s);
                return(db.SaveChanges() > 0);
            }
            return(false);
        }
Esempio n. 3
0
 private void categorie_MatrielDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 { // Supprimer
     if (e.ColumnIndex == categorie_MatrielDataGridView.Columns["Supprimer"].Index && e.RowIndex >= 0)
     {
         if (DialogResult.Yes == MessageBox.Show(
                 "Voullez-vous vraimment supprimer ce stagiaire",
                 "Confirmation de supprision", MessageBoxButtons.YesNo))
         {
             Categorie_Matriel s = (Categorie_Matriel)categorie_MatrielBindingSource.Current;
             //      new StagiairesService().Supprimer(s.Id);
             this.Actualiser();
         }
     }
     // Editer
     if (e.ColumnIndex == categorie_MatrielDataGridView.Columns["Modifier"].Index && e.RowIndex >= 0)
     {
         EditerStagiaireEvent(sender, e);
     }
 }
 public bool Ajouter(Categorie_Matriel s)
 {
     db.CMatriels.Add(s);
     return(db.SaveChanges() > 0);
 }