Esempio n. 1
0
        /// <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;
            }

        }
Esempio n. 2
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;
            }
        }