if (typeof(T) == typeof(PLC_CommunicationData) || typeof(T) == typeof(PLCDeviceInfo))
{
using (var context = new TuniSettingDataContext())
{
if (Exist<T>(entity))
{
context.Entry<T>(entity).State = EntityState.Modified;
}
else
{
context.Entry<T>(entity).State = EntityState.Added;
}
return context.SaveChanges() > 0;
}
}