public static void SetSetting(string key, string value) { if (!Program.Running) { return; } using (var db = new SettingsDB()) { db.Settings.Where(p => p.Name == key).Set(p => p.Text, value).Update(); } }
public static string GetSetting(string key) { if (!Program.Running) { return ""; } var keyValue = ""; using (var db = new SettingsDB()) { var firstOrDefault = db.Settings.FirstOrDefault(x => x.Name.Equals(key)); if (firstOrDefault != null) keyValue = firstOrDefault.Text; } return keyValue; }