public Matriel RechercheParId(string id)
        {
            Matriel s = db.Matriels
                        .Where(i => i.NumeroInvontaire == id)
                        .SingleOrDefault();

            return(s);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Matriel matriel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(matriel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(matriel));
 }
        public bool Update(Matriel s)
        {
            var original = db.Matriels.Find(s.NumeroInvontaire);

            if (original != null)
            {
                db.Entry(original).CurrentValues.SetValues(s);
                return(db.SaveChanges() > 0);
            }
            return(false);
        }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "id,matName")] Matriel matriel)
        {
            if (ModelState.IsValid)
            {
                db.Matriels.Add(matriel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(matriel));
        }
Ejemplo n.º 5
0
        private void matrielDataGridView_CellContentClick_2(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == matrielDataGridView.Columns["Sortie"].Index && e.RowIndex >= 0)
            {
                string     a  = (string)matrielDataGridView.SelectedRows[0].Cells[0].Value;
                Matriel    c  = (Matriel)matrielBindingSource.Current;
                FormSortie ab = new FormSortie();
                ab.afficher(a);

                ab.ShowDialog();
            }
        }
Ejemplo n.º 6
0
        public ActionResult DeleteConfirmed(int id)
        {
            foreach (var item in db.BuildingMatrials.Where(x => x.MatID == id))
            {
                db.BuildingMatrials.Remove(item);
            }
            Matriel matriel = db.Matriels.Find(id);

            db.Matriels.Remove(matriel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        // GET: Matriels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Matriel matriel = db.Matriels.Find(id);

            if (matriel == null)
            {
                return(HttpNotFound());
            }
            return(View(matriel));
        }
Ejemplo n.º 8
0
 private void matrielDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     // Supprimer
     if (e.ColumnIndex == matrielDataGridView.Columns["Supprimer"].Index && e.RowIndex >= 0)
     {
         if (DialogResult.Yes == MessageBox.Show(
                 "Voullez-vous vraimment supprimer ce stagiaire",
                 "Confirmation de supprision", MessageBoxButtons.YesNo))
         {
             Matriel s = (Matriel)matrielBindingSource.Current;
             new ServiceMatriel().Supprimer(s.NumeroInvontaire);
             //      new StagiairesService().Supprimer(s.Id);
             this.Actualiser();
         }
     }
     // Editer
     if (e.ColumnIndex == matrielDataGridView.Columns["Modifier"].Index && e.RowIndex >= 0)
     {
         EditerStagiaireEvent(sender, e);
     }
 }
 public bool Ajouter(Matriel s)
 {
     db.Matriels.Add(s);
     return(db.SaveChanges() > 0);
 }