示例#1
0
 public static bool Delete <T>(T value) where T : class
 {
     try
     {
         int index = -1;
         //Console.WriteLine(value.GetType().FullName);
         WmsTakModel.Entry(value).State = EntityState.Deleted;
         index = WmsTakModel.SaveChanges();
         return(index >= 0);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
示例#2
0
 public static bool Add(object value)
 {
     try
     {
         int index = -1;
         //Console.WriteLine(value.GetType().FullName);
         WmsTakModel.Entry(value).State = EntityState.Added;
         index = WmsTakModel.SaveChanges();
         return(index >= 0);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     return(false);
 }