Exemple #1
0
 public async void createRelationship(string from, string to, string type)
 {
     Relation r = new Relation { to = uri + "node/" + to, type = type };
     await h.PostAsync(uri + "node/" + from + "/relationships", new StringContent(JsonConvert.SerializeObject(r).ToString(), Encoding.UTF8, "application/json"));
 }
Exemple #2
0
        public async Task<IHttpActionResult> createClass(Class a)
        {
            a.standard = a.standard.ToUpper();
            g.Connect();
            NodeReference<Class> node = g.Create(a);
            long x = node.Id;
            a.self = x.ToString();
            g.Update<Class>(node, a);
            await h.PostAsync(uri + "node/" + x + "/labels", new StringContent("\"class\""));

            Relation r = new Relation { to = uri + "node/" + a.school, type = "institute" };
            await h.PostAsync(uri + "node/" + x + "/relationships", new StringContent(JsonConvert.SerializeObject(r).ToString(), Encoding.UTF8, "application/json"));

            r = new Relation { to = uri + "node/" + x, type = "class" };
            await h.PostAsync(uri + "node/" + a.school + "/relationships", new StringContent(JsonConvert.SerializeObject(r).ToString(), Encoding.UTF8, "application/json"));
            return Ok(a);
        }