Exemplo n.º 1
0
 public static void Delete(int id)
 {
     using (TrainingContext db = new TrainingContext())
     {
         Team newTeam = db.Teams.Find(id);
         db.Teams.Remove(newTeam);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
            }
        }