Exemplo n.º 1
0
 private static string GetApplicationData(string key)
 {
     using (var context = new SettingsStorage())
     {
         var result = context.ApplicationSettings.Where(a => a.Key == key).Select(a => a.Value).FirstOrDefault();
         return result;
     }
 }
Exemplo n.º 2
0
 private static void SetApplicationData(string key, string value)
 {
     using (var context = new SettingsStorage())
     {
         var result = context.ApplicationSettings.Where(a => a.Key == key).Select(a => a).FirstOrDefault();
         if (result == null)
         {
             var appSettings = new ApplicationSettings { Key = key, Value = value };
             context.AddToApplicationSettings(appSettings);
         }
         else
         {
             result.Value = value;
         }
         context.SaveChanges();
     }
 }