Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. public List<Store> returnProductStore(String productname)
  2.         {
  3.             Dictionary<string, object> queryDict = new Dictionary<string, object>();
  4.             queryDict.Add("productname", productname);
  5.  
  6.             var query = new Neo4jClient.Cypher.CypherQuery("MATCH (p:Product)-[r:COST]->(s:Store) WHERE p.name =~ {productname} RETURN s.name",//r.price
  7.                                                             queryDict, CypherResultMode.Set);
  8.  
  9.             List<string> nameList = ((IRawGraphClient)client).ExecuteGetCypherResults<string>(query).ToList();
  10.  
  11.             query = new Neo4jClient.Cypher.CypherQuery("MATCH (p:Product)-[r:COST]->(s:Store) WHERE p.name =~ {productname} RETURN r.price",
  12.                                                             queryDict, CypherResultMode.Set);
  13.  
  14.             List<int> priceList = ((IRawGraphClient)client).ExecuteGetCypherResults<int>(query).ToList();
  15.  
  16.             List<Store> storeList = new List<Store>();
  17.  
  18.             for(int i=0;i<nameList.Count;i++)
  19.             {
  20.                 storeList.Add(new DomainModel.Store(nameList[i], priceList[i]));
  21.             }
  22.  
  23.             return storeList;
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement