public static DomainModel GenerateMatrix(RestfulGraphDatabase rgd) { string key = "key_get"; string value = "value"; DomainModel dm = new DomainModel(); DomainEntity thomas = new DomainEntity(); thomas.Properties["name"] = "Thomas Anderson"; thomas.Location = ( URI )rgd.CreateNode("{\"name\":\"" + "Thomas Anderson" + "\"}").Metadata.getFirst("Location"); dm.Add(thomas); DomainEntity agent = new DomainEntity(); agent.Properties["name"] = "Agent Smith"; agent.Location = ( URI )rgd.CreateNode("{\"name\":\"" + "Agent Smith" + "\"}").Metadata.getFirst("Location"); dm.Add(agent); dm.NodeIndexName = "matrixal-nodes"; dm.IndexedNodeKeyValues[key] = value; dm.IndexedNodeUriToEntityMap[( URI )rgd.AddToNodeIndex(dm.NodeIndexName, null, null, "{\"key\": \"" + key + "\", \"value\":\"" + value + "\", \"uri\": \"" + thomas.Location + "\"}").Metadata.getFirst("Location")] = thomas; dm.IndexedNodeUriToEntityMap[( URI )rgd.AddToNodeIndex(dm.NodeIndexName, null, null, "{\"key\": \"" + key + "\", \"value\":\"" + value + "\", \"uri\": \"" + agent.Location + "\"}").Metadata.getFirst("Location")] = agent; return(dm); }
public ActionResult AddToMenu(DateTime data, string pasto, string giorno, string primo, string secondo, string contorno, string dolce) { Menu nuovo = new Menu { Data = data, Pasto = pasto, Primo = primo, Secondo = secondo, Giorno = giorno, Contorno = contorno, Dolce = dolce }; try { dm.Add(nuovo); }catch (Exception e) { throw e; } ViewBag.ListaMenu = dm.GetLista(); ViewBag.Message = "Menu aggiunto"; return(View("ListaMenu")); }
// POST api/<controller> public void Post([FromBody] Prodotto nuovo) { dm.Add(nuovo); }