/// <summary>
 /// Create a new PrdnUserSetting object.
 /// </summary>
 /// <param name="userID">Initial value of the UserID property.</param>
 public static PrdnUserSetting CreatePrdnUserSetting(global::System.Decimal userID)
 {
     PrdnUserSetting prdnUserSetting = new PrdnUserSetting();
     prdnUserSetting.UserID = userID;
     return prdnUserSetting;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the PrdnUserSettings EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPrdnUserSettings(PrdnUserSetting prdnUserSetting)
 {
     base.AddObject("PrdnUserSettings", prdnUserSetting);
 }
        protected int UpdateUserSettings(decimal userID, Action<PrdnUserSetting> updProc)
        {
            PrdnUserSetting setting;

            setting = (from s in PrdnDBContext.PrdnUserSettings
                       where s.UserID == userID
                       select s).FirstOrDefault();

            if (setting == null)
            {
                setting = new PrdnUserSetting
                {
                    UserID = userID
                };
            }

            updProc(setting);

            if (setting.EntityState == EntityState.Detached)
            {
                PrdnDBContext.PrdnUserSettings.AddObject(setting);
            }

            ClearUserSettings();
            return PrdnDBContext.SaveChanges();
        }