Beispiel #1
0
 public IActionResult Post([FromBody] UnitStop value)
 {
     using (var session = _cluster.Connect(KeySpace))
     {
         session.Execute($"insert into bus_stops values({value.Title}, {value.Latitude}, {value.Longitude});");
         return(Ok());
     }
 }
Beispiel #2
0
 public IActionResult Put(int id, [FromBody] UnitStop value)
 {
     if (value.Id != id)
     {
         return(BadRequest());
     }
     using (var session = _cluster.Connect(KeySpace))
     {
         session.Execute($"update bus_stops " +
                         $"set title={value.Title}, latitude={value.Latitude}, longitude={value.Longitude} " +
                         $"where id={id};");
         return(Ok());
     }
 }