private void SetPreference(string key, string value) { var pref = _preferenceRepository.FindByKey(key); if (pref == null) { pref = new Preference { Key = key }; } pref.Value = value; _preferenceRepository.SaveItem(pref); PreferenceUpdated?.Invoke(this, new WowUpPreferenceEventArgs(pref)); }
public bool SaveItem(Preference item) { lock (_collisionLock) { item.UpdatedAt = DateTime.UtcNow; if (item.Id != 0) { _database.Update(item); } else { _database.Insert(item); } } PreferenceUpdated?.Invoke(this, new Models.Events.PreferenceEventArgs(item)); return(true); }