public void SetUserPreference(int id, string pref, object value) { var u = Users.Single(uu => uu.UserId == id); var p = u.Preferences.SingleOrDefault(up => up.PreferenceX == pref); if (p != null) { if (p.ValueX == value.ToString()) { return; } p.ValueX = value.ToString(); } else { p = new Preference { UserId = id, PreferenceX = pref, ValueX = value.ToString() }; Preferences.InsertOnSubmit(p); } SubmitChanges(); }
private void detach_Preferences(Preference entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_Preferences(Preference entity) { this.SendPropertyChanging(); entity.User = this; }