I have the following code:
try
{
modelOn.pacienteOns.Add(Conversao.pacienteToOn(oObjeto));
oObjeto.online = 1;
modelOn.SaveChanges();
modelOff.SaveChanges();
}
catch (Exception i)
{
MessageBox.Show("----------------->>> " + i);
}
I need the system to execute the two commands modelOn.SaveChanges()
and modelOff.SaveChanges()
, if it does not execute one, it should not execute the other one.
My question is: Since I have included both of the codes within try
, will either the two be executed or do I run one?