Exemple #1
0
 public void SaveChanges()
 {
     try
     {
         using (var context = new FUTSettingsDatabase())
         {
             var me = context.FUTListItems.FirstOrDefault(x => x.ID == ID);
             if (me != null)
             {
                 context.Entry(me).CurrentValues.SetValues(this);
                 context.SaveChanges();
             }
         }
     }
     catch { }
 }
 public static void UpdateFUTListItem(FUTListItem item)
 {
     using (var context = new FUTSettingsDatabase())
     {
         var savedItem = context.FUTListItems.FirstOrDefault(x => x.ID == item.ID);
         if (savedItem == null)
         {
             InsertFUTListItem(item);
         }
         else
         {
             context.Entry(savedItem).CurrentValues.SetValues(item);
             context.SaveChanges();
         }
     }
 }