示例#1
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            int       Id        = int.Parse(ProfView.SelectedValue.ToString());
            DBContext dBContext = new DBContext();

            EntityBiblio.Model.Professor prof = (from c in dBContext.Professors where c.Id == Id select c).Single();
            var elmProf = dBContext.Departements.Where(b => b.NomDep == Depart.SelectedValue).FirstOrDefault();

            prof.Nom    = NomProf.Text;
            prof.Prenom = prenomProf.Text;
            prof.Tel    = Tel.Text;
            prof.CIN1   = Cin.Text;
            prof.Email  = Email.Text;
            prof.IdDep  = elmProf.Id;
            dBContext.SaveChanges();
            Response.Redirect("/Professor.aspx");
        }
示例#2
0
        protected void ProfView_SelectedIndexChanged(object sender, EventArgs e)
        {
            DBContext dBContext = new DBContext();

            int Id = int.Parse(ProfView.SelectedValue.ToString());

            EntityBiblio.Model.Professor prof = (from c in dBContext.Professors where c.Id == Id select c).Single();

            var elmProf = dBContext.Departements.Where(b => b.Id == prof.IdDep).FirstOrDefault();

            NomProf.Text         = prof.Nom;
            prenomProf.Text      = prof.Prenom;
            Tel.Text             = prof.Tel;
            Cin.Text             = prof.CIN1;
            Email.Text           = prof.Email;
            Depart.SelectedValue = elmProf.NomDep;
        }