public async Task <IActionResult> Edit(int id, [Bind("Matricule,NomM,PrenomM,IdSpecialite,Ville,Adresse,Niveau,NbrPatients,Id")] Docteur docteur) { if (id != docteur.Id) { return(NotFound()); } if (ModelState.IsValid) { try { CliniqueDbContext context = _contextFactory.CreateDbContext(); context.Update(docteur); await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocteurExists(docteur.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdSpecialite"] = new SelectList(_contextFactory.CreateDbContext().Specialites, "Id", "Titre", docteur.IdSpecialite); return(View(docteur)); }
public async Task <IActionResult> Create([Bind("Matricule,NomM,PrenomM,IdSpecialite,Ville,Adresse,Niveau,NbrPatients,Id")] Docteur docteur) { if (ModelState.IsValid) { CliniqueDbContext context = _contextFactory.CreateDbContext(); context.Add(docteur); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdSpecialite"] = new SelectList(_contextFactory.CreateDbContext().Specialites, "Id", "Titre", docteur.IdSpecialite); return(View(docteur)); }
public static int Update(Docteur doc) { Dictionary<string, Object> dicParam = new Dictionary<string, Object>(); dicParam.Add("@IDDocteur", doc.IDDocteur); dicParam.Add("@NomDocteur", doc.NomDocteur); dicParam.Add("@PrenomDocteur", doc.PrenomDocteur); dicParam.Add("@Telephone", doc.Telephone); dicParam.Add("@Cellulaire", doc.Cellulaire); dicParam.Add("@IDSpecialite", doc.IDSpecialite); return AccesBD.Current.ExecuteNonQuery("UPDATE Docteurs SET NomDocteur=@NomDocteur, PrenomDocteur=@PrenomDocteur, Telephone=@Telephone, Cellulaire=@Cellulaire, IDSpecialite=@IDSpecialite WHERE IDDocteur=@IDDocteur", dicParam, CommandType.Text); }
protected void grd_Doc_RowUpdating(object sender, GridViewUpdateEventArgs e) { //NEMARCHEPAS int ID = int.Parse(grd_Doc.DataKeys[e.RowIndex].Value.ToString()); string nomDoc = ((TextBox)(grd_Doc.Rows[grd_Doc.EditIndex].Cells[0].FindControl("txtNomDoc"))).Text; string prenomDoc = ((TextBox)(grd_Doc.Rows[grd_Doc.EditIndex].FindControl("txtPrenomDoc"))).Text; int specialite = int.Parse(((DropDownList)(grd_Doc.Rows[e.RowIndex].FindControl("ddlSpecDoc"))).SelectedValue); string txtt = ((TextBox)(grd_Doc.Rows[grd_Doc.EditIndex].FindControl("txtt"))).Text; string txtc = ((TextBox)(grd_Doc.Rows[grd_Doc.EditIndex].FindControl("txtc"))).Text; Docteur d = new Docteur(); d.IDDocteur = ID; d.NomDocteur = nomDoc; d.PrenomDocteur = prenomDoc; d.IDSpecialite = specialite; d.Telephone = txtt; d.Cellulaire = txtc; int temp = docteurDAL.Update(d); lstDoc = docteurDAL.GetAllDoc(); grd_Doc.EditIndex = -1; grd_Doc.DataBind(); }