public int Guardarclabe(Ca_Clabe item) { int Val = 0; try { using (ClusmextContext context = new ClusmextContext()) { if (item.Id_Clabe > 0) { context.Entry(item).State = EntityState.Modified; } else { context.Entry(item).State = EntityState.Added; } Val = context.SaveChanges(); if (Val == 1) { Re_Bancos_Empresa re = new Re_Bancos_Empresa(); re.Id_Empresa = item.Id_Empresa; re.Id_Banco = item.Id_Banco; re.F_Alta = DateTime.Now; re.Creado_por = item.Creado_por; re.Activo = true; Val = GuardarRelacion(re); } } } catch (Exception ex) { } return(Val); }
public int GuardarRelacion(Re_Bancos_Empresa items) { int Val = 0; try { using (ClusmextContext context = new ClusmextContext()) { context.Entry(items).State = EntityState.Added; Val = context.SaveChanges(); } } catch (Exception ex) { } return(Val); }