public ActionResult DeleteConfirmed(int id) { TopFootballersTable football = db.TopFootballersTables.Find(id); //deleting database record here db.TopFootballersTables.Remove(football); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id, Player_Name, Age, Place_of_Birth, Height, Playing_Position, Current_Team, National_Team, Description, Picture")] TopFootballersTable football) { if (ModelState.IsValid) { //Editing database record here db.Entry(football).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(football)); }
public ActionResult Add([Bind(Include = "Id, Player_Name, Age, Place_of_Birth, Height, Playing_Position, Current_Team, National_Team, Description, Picture")] TopFootballersTable football) { if (ModelState.IsValid) { //adding database record here db.TopFootballersTables.Add(football); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(football)); }
//Delete View public ActionResult Delete(int?id) { TopFootballersTable movie = db.TopFootballersTables.Find(id); return(View(movie)); }
//Edit View public ActionResult Edit(int?id) { TopFootballersTable football = db.TopFootballersTables.Find(id); return(View(football)); }