public List<Ligue> ReadLigue() { Ligue laligue = null; List<Ligue> List = new List<Ligue>(); using (MySqlConnection connection = new MySqlConnection(connectionString)) { connection.Open(); string query = "SELECT * FROM ligue"; //Create Command MySqlCommand cmd = new MySqlCommand(query, connection); //Create a data reader and Execute the command using (MySqlDataReader dataReader = cmd.ExecuteReader()) { //Read the data and store them in the list while (dataReader.Read()) { laligue = new Ligue(); laligue.setnom((string)dataReader["nom_ligue"]); List.Add(laligue); } } } return List; }
public ActionResult DeleteConfirmed(int id) { Ligue ligue = db.Ligue.Find(id); db.Ligue.Remove(ligue); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] Ligue ligue) { if (ModelState.IsValid) { db.Entry(ligue).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ligue)); }
public ActionResult Create([Bind(Include = "Id,Name")] Ligue ligue) { if (ModelState.IsValid) { db.Ligue.Add(ligue); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ligue)); }
// GET: Ligues/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ligue ligue = db.Ligue.Find(id); if (ligue == null) { return(HttpNotFound()); } return(View(ligue)); }