public static void IzmeniPripada(Pripada pripada) { Dictionary <string, object> queryDictionary = new Dictionary <string, object>(); queryDictionary.Add("id", pripada.id); queryDictionary.Add("datum_od", pripada.datum_od); CypherQuery query; if (pripada.datum_do != DateTime.MinValue) { queryDictionary.Add("datum_do", pripada.datum_do); query = new Neo4jClient.Cypher.CypherQuery("match (f:Firma)-[r:PRIPADA {id:{id}}]-(p:Projekat) SET r={id:{id}, datum_od:{datum_od}, datum_do:{datum_do}} return r", queryDictionary, CypherResultMode.Set); } else { query = new Neo4jClient.Cypher.CypherQuery("match (f:Firma)-[r:PRIPADA {id:{id}}]-(p:Projekat) SET r={id:{id}, datum_od:{datum_od}} return r", queryDictionary, CypherResultMode.Set); } ((IRawGraphClient)Session.Client).ExecuteGetCypherResults <Projekat>(query); //match (f:Firma)-[r:PRIPADA {id:0}]-(p:Projekat) SET r.datum_od="01.01.1999" return r; }
public IActionResult IzmeniPripada([FromBody] Pripada pripada) { try { DataLayer.DataProvider.IzmeniPripada(pripada); return(Ok()); } catch (Exception e) { return(BadRequest(e.ToString())); } }
public static void DodajPripada(string nazivFirme, string nazivProjekta, Pripada pripada) { pripada.id = DataProvider.getMaxId() + 1; var query = Session.Client.Cypher .Match("(f:Firma)", "(p:Projekat)") .Where((Firma f) => f.naziv == nazivFirme) .AndWhere((Projekat p) => p.naziv == nazivProjekta) .Create("(f)-[r:PRIPADA {pripada}]->(p)") .WithParam("pripada", pripada); query.ExecuteWithoutResults(); }
public IActionResult DodajProjekatFirmi([FromRoute(Name = "nazivProjekta")] string nazivProjekta, [FromRoute(Name = "nazivFirme")] string nazivFirme, [FromBody] Pripada pripada) { try { DataLayer.DataProvider.DodajPripada(nazivFirme, nazivProjekta, pripada); return(Ok()); } catch (Exception e) { return(BadRequest(e.ToString())); } }