public List<TestTable> GetTestRecords()
 {
     using (var context = new DataEntities())
     {
         return context.TestTables.ToList();
     }
 }
        public bool SetTestRecords(List<TestTable> records)
        {
            using (var context = new DataEntities())
            {
                foreach (var item in records)
                {
                    var entity = context.Entry(item);
                    switch (item.EntityState)
                    {
                        case -1:
                            entity.State = EntityState.Deleted;
                            break;
                        case 1:
                            entity.State = EntityState.Added;
                            break;
                        default:
                            entity.State = EntityState.Modified;
                            break;
                    }
                }

                context.SaveChanges();
                return true;
            }
        }