Exemple #1
0
        public NccSettings SetByKey(string key, string value)
        {
            var settings = _entityRepository.Query().FirstOrDefault(x => x.Key == key);

            if (settings != null)
            {
                settings.Value = value;
                _entityRepository.Edit(settings);
            }
            else
            {
                settings = new NccSettings()
                {
                    Key = key, Value = value
                };
                _entityRepository.Add(settings);
            }
            _entityRepository.SaveChange();

            return(settings);
        }
Exemple #2
0
 public NccSettings GetByKey(string key)
 {
     return(_entityRepository.Query().FirstOrDefault(x => x.Key == key));
 }