public async Task <ActionResult> Get() { var listOfPollution = _session.Execute("select * from alertPollution where about='Need to be solved' ALLOW FILTERING"); IList <AlertPollution> pollutions = new List <AlertPollution>(); foreach (var res in listOfPollution) { AlertPollution p = new AlertPollution(); p.SensorId = res.GetValue <string>("sensorid"); p.CollectTime = res.GetValue <DateTimeOffset>("collecttime"); p.SensorData = res.GetValue <float>("sensordata"); p.About = res.GetValue <string>("about"); pollutions.Add(p); } return(Ok(pollutions)); }
public async Task Solve([FromBody] AlertPollution alertPollution) { _session.Execute("UPDATE alertPollution SET about='Solved' where sensorid='" + alertPollution.SensorId + "' AND collecttime=" + alertPollution.CollectTime.ToUnixTimeMilliseconds()); }