public static void Guardar(Clientes cl) { try { Parcial1Db db = new Parcial1Db(); db.Clientes.Add(cl); db.SaveChanges(); db.Dispose(); } catch (Exception ex) { throw ex; } }
public static void Guardar(TiposTelefonos tpt) { try { var db = new Parcial1Db(); db.TipoTelefonos.Add(tpt); var gp = db.TipoTelefonos.Add(tpt); foreach (var clie in tpt.Clientes) { db.Entry(clie).State = EntityState.Unchanged; } db.SaveChanges(); db.Dispose(); } catch (Exception ex) { throw ex; } }