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); } }
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); }