public async System.Threading.Tasks.Task<int> AddSensorData(sensor_data sensor_data) { sensor_data.timestamp = DateTime.Now; db.sensor_data.Add(sensor_data); return await db.SaveChangesAsync(); }
public async Task<IHttpActionResult> Postsensor_data(sensor_data sensor_data) { if (!ModelState.IsValid) { return BadRequest(ModelState); } await db.AddSensorData(sensor_data); return CreatedAtRoute("DefaultApi", new { id = sensor_data.Id }, sensor_data); }