Exemplo n.º 1
0
        /// <summary>
        /// Methode zum Aendern einer FussballWM
        /// </summary>
        public static FussballWM UpdateWM(FussballWM wm)
        {
            if (wm == null)
                throw new ArgumentNullException("wm");

            using (var context = new WM2010Entities())
            {
                var update = CqFussballWM.Invoke(context, wm.FussballWMId);
                if (update == null)
                    throw new ObjectNotFoundException("FussballWM not found");

                context.ApplyPropertyChanges(update.EntityKey.EntitySetName, wm);
                context.SaveChanges();

                context.Refresh(RefreshMode.StoreWins, wm);
                return wm;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Methode zum Aendern eines Spiels
        /// </summary>
        public static Spiel UpdateSpiel(Spiel spiel)
        {
            if (spiel == null)
                throw new ArgumentNullException("spiel");

            using (var context = new WM2010Entities())
            {
                var so = CqSpiel.Invoke(context, spiel.Id);

                if (so == null)
                    return null;

                context.ApplyPropertyChanges(so.EntityKey.EntitySetName, spiel);
                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, so);

                so.SpielOrtReference.Load();
                return so;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Methode zum Aendern eines SpielOrtes
        /// </summary>
        public static SpielOrt UpdateSpielOrt(SpielOrt spielOrt)
        {
            if (spielOrt == null)
                throw new ArgumentNullException("spielOrt");

            using (var context = new WM2010Entities())
            {
                var so = CqSpielOrt.Invoke(context, spielOrt.SpielOrtId);

                context.ApplyPropertyChanges(so.EntityKey.EntitySetName, spielOrt);
                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, spielOrt);
                return spielOrt;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Aendert eine Spielposition 
        /// </summary>
        public static SpielPosition UpdateSpielPosition(SpielPosition position)
        {
            if (position == null)
                throw new ArgumentNullException("position");

            using (var context = new WM2010Entities())
            {
                var sp = CqSpielPosition.Invoke(context, position.SpielPositionId);
                if (sp == null)
                    throw new ObjectNotFoundException("spielposition");

                context.ApplyPropertyChanges(sp.EntityKey.EntitySetName, position);
                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, position);
                return position;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Aendert einen Spieler
        /// </summary>
        public static Spieler UpdateSpieler(Spieler spieler)
        {
            if (spieler == null)
                throw new ArgumentNullException("spieler");

            using (var context = new WM2010Entities())
            {
                var s = CqSpieler.Invoke(context, spieler.SpielerId);
                if (s == null)
                    throw new ObjectNotFoundException("spieler");

                context.ApplyPropertyChanges(s.EntityKey.EntitySetName, spieler);
                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, spieler);

                return spieler;
            }
        }
Exemplo n.º 6
0
        public static Gruppe UpdateGruppe(Gruppe gruppe)
        {
            if (gruppe == null)
                throw new ArgumentNullException("gruppe");

            using (var context = new WM2010Entities())
            {
                var g = CqGruppe.Invoke(context, gruppe.GruppeId);
                context.ApplyPropertyChanges(g.EntityKey.EntitySetName, gruppe);
                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, gruppe);
                return gruppe;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Methode zum Aendern einer Mannschaft
        /// </summary>
        public static Mannschaft UpdateMannschaft(Mannschaft mannschaft)
        {
            if (mannschaft == null)
                throw new ArgumentNullException("mannschaft");


            using (var context = new WM2010Entities())
            {
                var m = CqMannschaft.Invoke(context, mannschaft.MannschaftId);
                

                context.ApplyPropertyChanges(m.EntityKey.EntitySetName, mannschaft);
                context.SaveChanges();

                context.Refresh(RefreshMode.StoreWins, m);

                return m;
            }
        }