private bool ConnectionInDb(Connection connection) { int count = (from c in db.Connections where (c.ToID == connection.ToID && c.FromID == connection.FromID) select c).ToList().Count; return count == 0 ? false : true; }
private bool ConnectionExists(Connection con) { if (!visitingIDList.Contains(con.ToID)) { return false; } if (visitedIDList.Contains(con.FromID)) { return true; } if (visitingIDList.Contains(con.FromID)) { return true; } return false; }