public void SaveType(Atype atype)
        {
            // if it's a new type, just attach it to the DataContext
            if (atype.Id == 0)
                typesTable.InsertOnSubmit(atype);
            else if (typesTable.GetOriginalEntityState(atype) == null)
            {
                // We're updating an existing type, but it's not attached to this DataContext
                // so attach it and detect changes
                typesTable.Attach(atype);
                typesTable.Context.Refresh(RefreshMode.KeepCurrentValues, atype);
            }

            typesTable.Context.SubmitChanges();
        }
 public void DeleteType(Atype atype)
 {
     typesTable.DeleteOnSubmit(atype);
     typesTable.Context.SubmitChanges();
 }