Beispiel #1
0
        public void Save(Model.Event _event)
        {
            using (DataContext context = new DataContext())
            {
                if (_event.Id == 0)
                {
                    context.Events.Add(_event);
                }
                else
                {
                    context.Entry(_event).State = EntityState.Modified;
                }

                context.SaveChanges();
            }
        }
Beispiel #2
0
        public void Save(Model.Player player)
        {
            using (DataContext context = new DataContext())
            {
                if (player.Id == 0)
                {
                    context.Players.Add(player);
                }
                else
                {
                    context.Entry(player).State = EntityState.Modified;
                }

                context.SaveChanges();
            }
        }