I want to pass the result of a cypher query to MVC's view using model. The obtained result is in form of nodes which I get in var result
.
Now I want to pass this result to a view as model, so that I can print the obtained result in a razor view.
My model class is as:
public class Item {
public int id {get; set;}
public string name {get; set;}
public string type {get; set;}
}
And my controller method is as:
public ActionResult Index()
{
using(var driver = GraphDatabase.Driver("bolt://localhost:7687","neo4j", "12345")
{
using(var session = driver.Session())
{
using(var tx = session.ReadTransaction())
{
var result = tx.Run("MATCH (m:Item) RETURN m")
}
}
}
return View();
}