コード例 #1
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// Methode zum Erstellen einer FussballWM
        /// </summary>
        public static FussballWM CreateWM(FussballWM wm)
        {
            if (wm == null)
                throw new ArgumentNullException("wm");

            using (var context = new WM2010Entities())
            {
                context.AddToFussballWM(wm);
                context.SaveChanges();

                context.Refresh(RefreshMode.StoreWins, wm);
                return wm;
            }

        }
コード例 #2
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <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;
            }
        }
コード例 #3
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// Methode zum Loeschen eines Spiels
        /// </summary>
        public static void DeleteSpiel(int spielId)
        {
            if (spielId < 0)
                throw new ArgumentNullException("spielId");

            using (var context = new WM2010Entities())
            {
                var so = CqSpiel.Invoke(context, spielId);
                if (so == null)
                    throw new ObjectNotFoundException("Spiel");

                context.DeleteObject(so);
                context.SaveChanges();
            }
        }
コード例 #4
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <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;
            }
        }
コード例 #5
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <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;
            }
        }
コード例 #6
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// Methode zum Erstellen eines SpielOrtes
        /// </summary>
        public static SpielOrt CreateSpielOrt(SpielOrt spielOrt)
        {
            if (spielOrt == null)
                throw new ArgumentNullException("spielOrt");

            using (var context = new WM2010Entities())
            {
                context.AddToSpielOrt(spielOrt);
                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, spielOrt);

                return spielOrt;
            }
        }
コード例 #7
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <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;
            }
        }
コード例 #8
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// 
        /// </summary>
        public static SpielPosition CreateSpielPosition(SpielPosition position)
        {
            if (position == null)
                throw new ArgumentNullException("position");

            using (var context = new WM2010Entities())
            {
                context.AddToSpielPosition(position);
                context.SaveChanges();
            }
            return position;

        }
コード例 #9
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <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;
            }
        }
コード例 #10
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// Methode zum Erstellen eines Spielers
        /// </summary>
        public static Spieler CreateSpieler(Spieler spieler)
        {
            if (spieler == null)
                throw new ArgumentNullException("spieler");

            using (var context = new WM2010Entities())
            {
                context.AddToSpieler(spieler);
                context.SaveChanges();

                context.Refresh(RefreshMode.StoreWins, spieler);
            }
            return spieler;
        }
コード例 #11
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        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;
            }
        }
コード例 #12
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// Methode zum Erstellen einer Gruppe
        /// </summary>
        public static Gruppe CreateGruppe(Gruppe gruppe)
        {
            if (gruppe == null)
                throw new ArgumentNullException("gruppe");

            using (var context = new WM2010Entities())
            {
                context.AddToGruppe(gruppe);
                context.SaveChanges();

                context.Refresh(RefreshMode.StoreWins, gruppe);
            }
            return gruppe;
        }
コード例 #13
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <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;
            }
        }
コード例 #14
0
ファイル: WM2010Manager.cs プロジェクト: MarioBinder/WM2010
        /// <summary>
        /// Methode zum Erstellen einer Mannschaft
        /// </summary>
        public static Mannschaft CreateMannschaft(Mannschaft mannschaft)
        {
            if (mannschaft == null)
                throw new ArgumentNullException("mannschaft");


            using (var context = new WM2010Entities())
            {
                context.AddToMannschaft(mannschaft);
                //context.Detach(mannschaft.Gruppe);

                context.SaveChanges();
                context.Refresh(RefreshMode.StoreWins, mannschaft);
            }

            return mannschaft;
        }