protected async void setHW_Click(object sender, EventArgs e) { Institute i = JsonConvert.DeserializeObject<Institute>(Session["u"].ToString()); GraphClient g = new GraphClient(new Uri("http://neo4jvm1.cloudapp.net:7474/db/data")); g.Connect(); string cc = class_.InnerText; string c= (g.Cypher.Match("(i:`institute`)--(n:`class` {school:\""+i.self+"\",standard:\""+cc[0]+"\",section:\""+cc[4]+"\"})").Where("id(i)="+i.self).Return<string>("id(n)").Results.ToList())[0]; Homework hw = new Homework { detail = detail.InnerText, class_ = c, on = DateTime.Today.ToString("dd-MMM-yy"), subject = "" }; await h.PostAsync(url+"hw/",new StringContent(JsonConvert.SerializeObject(hw),System.Text.Encoding.UTF8,"application/json")); }
public async Task<IHttpActionResult> createHW(Homework a) { g.Connect(); NodeReference<Homework> node = g.Create(a); string x = node.Id.ToString(); a.self = x.ToString(); g.Update<Homework>(node, a); await h.PostAsync(uri + "node/" + x + "/labels", new StringContent("\"homework\"")); createRelationship(x, a.class_, "homework"); createRelationship(a.class_, x, "class_hw"); return Ok(a); }