public ActionResult Create(Team team) { if (ModelState.IsValid) { db.Teams.Add(team); db.SaveChanges(); return RedirectToAction("Index"); } return View(team); }
//Push functions push the objects into the database if they are not found public Team pushTeam(Team Team) { Team DBTeam = Teams.Find(Team.Name); if (DBTeam == null) { Teams.Add(Team); return Team; } else { return DBTeam; } }
public ActionResult Edit(Team team) { if (ModelState.IsValid) { db.Entry(team).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(team); }