示例#1
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;
            }
        }
示例#2
0
        /// <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;

        }