Exemple #1
0
        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));
        }
Exemple #2
0
        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);
        }