public ActionResult Index(Etudiant e) { Models.Etudiant ets1 = new Models.Etudiant { Nom = "Dupont", Prenom = "jesaispas", Matricule = "055525896" }; return(View(ets1)); }
// GET: Home public ActionResult Index() { Models.Etudiant et1 = new Models.Etudiant { Nom = "Core", Prenom = "Jean-Webchel", Matricule = "LA020202" }; return(View(et1)); }
public static Models.Etudiant Rechercher(string CODEET) { Models.Etudiant e = new Models.Etudiant(); try { DataTable t = Controlers.DB.PROC_DS_Params("unetudiant", new SqlParameter[] { new SqlParameter("@codee", int.Parse(CODEET)) }).Tables[0]; if (t.Rows.Count != 0) { //instancier l'Etudiant trouvé e = new Models.Etudiant(int.Parse(t.Rows[0][0].ToString()), t.Rows[0][1].ToString(), t.Rows[0][2].ToString(), DateTime.Parse(t.Rows[0][3].ToString()), t.Rows[0][4].ToString()); } return(e); } catch { return(e); } }
public JsonResult GetStudentInfo(string id) { string connectionstring = @"server=192.168.1.28;DataBase=ExerciceAJAX;Uid=Alex123;Pwd=1234"; SqlConnection MyConnection = new SqlConnection(connectionstring); MyConnection.Open(); SqlCommand MyCmd = new SqlCommand(); MyCmd.Connection = MyConnection; MyCmd.CommandText = "getStudentInfo"; MyCmd.CommandType = CommandType.StoredProcedure; MyCmd.Parameters.AddWithValue("@Matricule", id); SqlDataReader reader; reader = MyCmd.ExecuteReader(); reader.Read(); Models.Etudiant et = new Models.Etudiant { Nom = reader["Nom"].ToString(), Prenom = reader["Prenom"].ToString(), Localite = reader["Localite"].ToString() }; reader.Close(); MyConnection.Close(); return(Json(et)); }
public JsonResult GetStudentInfo(string id) { string ConnectionStr = @"Server=127.0.0.1\SQLEXPRESS;Database=dbCours20172018;Uid=Cours2018;Pwd=password;"; SqlConnection MyConnection = new SqlConnection(ConnectionStr); MyConnection.Open(); SqlCommand MyCmd = new SqlCommand(); MyCmd.Connection = MyConnection; MyCmd.CommandType = System.Data.CommandType.StoredProcedure; MyCmd.CommandText = "GetStudentInfo"; MyCmd.Parameters.AddWithValue("@Matricule", id); SqlDataReader MyRd = MyCmd.ExecuteReader(); MyRd.Read(); Models.Etudiant etud = new Models.Etudiant { Nom = MyRd["Nom"].ToString(), Prenom = MyRd["Prenom"].ToString(), Localite = MyRd["Localite"].ToString() }; MyRd.Close(); MyConnection.Close(); return(Json(etud)); }