protected void BtAdd_Click(object sender, EventArgs e) { AccesDBGestionProject.Models.Departement newdep = new AccesDBGestionProject.Models.Departement(); newdep.Description = TBDescription.Text; newdep.Ville = TBVille.Text; dbContext.departements.Add(newdep); dbContext.SaveChanges(); }
protected void BtDel_Click(object sender, EventArgs e) { AccesDBGestionProject.Models.Departement newdep = new AccesDBGestionProject.Models.Departement(); Int32 iddep = int.Parse(TBId.Text.ToString()); newdep = dbContext.departements.Find(iddep); dbContext.departements.Remove(newdep); dbContext.SaveChanges(); }
protected void GridViewDescription_SelectedIndexChanged(object sender, EventArgs e) { AccesDBGestionProject.Models.Departement newdep = new AccesDBGestionProject.Models.Departement(); Int32 iddep = int.Parse(GridViewDepartement.SelectedValue.ToString()); newdep = dbContext.departements.Find(iddep); TBDescription.Text = newdep.Description.ToString(); TBId.Text = newdep.departementID.ToString(); TBVille.Text = newdep.Ville.ToString(); }
protected void BtUpdate_Click(object sender, EventArgs e) { AccesDBGestionProject.Models.Departement newdep = new AccesDBGestionProject.Models.Departement(); Int32 iddep = int.Parse(TBId.Text.ToString()); newdep = dbContext.departements.Find(iddep); newdep.Ville = TBVille.Text; newdep.Description = TBDescription.Text; dbContext.SaveChanges(); }