public static void Delete(int id) { using (TrainingContext db = new TrainingContext()) { Team newTeam = db.Teams.Find(id); db.Teams.Remove(newTeam); db.SaveChanges(); } }
public static void Update(int id, string name) { using (TrainingContext db = new TrainingContext()) { Team newTeam = db.Teams.Find(id); newTeam.Id = id; newTeam.Name = name; db.Teams.Update(newTeam); db.SaveChanges(); } }
public static void Insert(int id, string name) { using (TrainingContext db = new TrainingContext()) { Team newTeam = new Team(); newTeam.Id = id; newTeam.Name = name; db.Teams.Add(newTeam); db.SaveChanges(); } }