public void GyroValuesAPI(GyroValuesAPI A) { G3_Measure_GyroValues B = new G3_Measure_GyroValues(); B.Userid = A.Userid; B.RawX = A.RawX; B.RawY = A.RawY; B.RawZ = A.RawZ; B.MeasurementDate = DateTime.Now; if (B.RawX == 0 && B.RawY == 0 && B.RawZ == 0) { B.Status = "沒有運動跡象,建議專員前往查看"; B.Score = 10; } else { B.Status = "正在運動"; B.Score = 0; } using (GyroValues db = new GyroValues()) { db.G3_Measure_GyroValues.Add(B); db.SaveChanges(); } }