I have a simple piece of HTML code which is supposed to call C# function on a press of a button, but it looks like the URL is bad, can anyone help me with Razor syntax? So far I have the following:
<div class="test1">
<div class="col-md-4">
<h1>Some button</h1>
<input type="button" value="Create" onclick="location.href='@Url.Action("addAdress", "AdressController")'" />
<p></p>
</div>
And here is the Controller that is supposed to do something, name of the Controller is AdressController
private void addAdress()
{
Adress a = new Adress();
a.Number = "1";
a.Distance = 100;
Dictionary<string, object> queryDict = new Dictionary<string, object>();
queryDict.Add("Number", a.Number);
queryDict.Add("Distance", a.Distance);
var query = new Neo4jClient.Cypher.CypherQuery("CREATE (n:Adress {Number:'" + a.Number + "', Distance:'" + a.Distance + "'}) return n",
queryDict, CypherResultMode.Set);
List<Adress> adrese = ((IRawGraphClient)client).ExecuteGetCypherResults<Adress>(query).ToList();
/*
foreach (Adress a1 in adrese)
{
MessageBox.Show(a1.Number);
}
*/
}