protected void DepView_SelectedIndexChanged(object sender, EventArgs e) { int Id = int.Parse(DepView.SelectedValue.ToString()); EntityBiblio.Model.Departement dep = (from d in dBContext.Departements where d.Id == Id select d).Single(); textbox1.Text = dep.NomDep; textbox2.Text = dep.Budget.ToString(); }
protected void EditButton_Click(object sender, EventArgs e) { int Id = int.Parse(DepView.SelectedValue.ToString()); EntityBiblio.Model.Departement dep = (from d in dBContext.Departements where d.Id == Id select d).Single(); dep.NomDep = textbox1.Text; dep.Budget = Double.Parse(textbox2.Text); dBContext.SaveChanges(); Response.Redirect("/Depart.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { DBContext db = new DBContext(); EntityBiblio.Model.Departement De = new EntityBiblio.Model.Departement(); De.NomDep = textbox1.Text; De.Budget = Double.Parse(textbox2.Text); db.Departements.Add(De); db.SaveChanges(); Response.Redirect("/Depart.aspx"); }