示例#1
0
 public static void SaveConversion(Conversion conversion)
 {
     using (var context = new ConversionDBContext())
     {
         context.Entry(conversion).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#2
0
 public static void AddUser(User user)
 {
     using (var context = new ConversionDBContext())
     {
         context.Users.Add(user);
         context.SaveChanges();
     }
 }
示例#3
0
 public static void AddConversion(Conversion conversion)
 {
     using (var context = new ConversionDBContext())
     {
         conversion.DeleteDatabaseValues();
         context.Conversions.Add(conversion);
         context.SaveChanges();
     }
 }
示例#4
0
 public static void DeleteConversion(Conversion selectedConversion)
 {
     using (var context = new ConversionDBContext())
     {
         selectedConversion.DeleteDatabaseValues();
         context.Conversions.Attach(selectedConversion);
         context.Conversions.Remove(selectedConversion);
         context.SaveChanges();
     }
 }