diff options
Diffstat (limited to 'PollutometerWebApi/Controllers/ReadingsController.cs')
-rw-r--r-- | PollutometerWebApi/Controllers/ReadingsController.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/PollutometerWebApi/Controllers/ReadingsController.cs b/PollutometerWebApi/Controllers/ReadingsController.cs index 9767645..f915e17 100644 --- a/PollutometerWebApi/Controllers/ReadingsController.cs +++ b/PollutometerWebApi/Controllers/ReadingsController.cs @@ -12,8 +12,6 @@ namespace PollutometerWebApi.Controllers public IHttpActionResult GetAllReadings() { - Task.Run(() => EmailService.Start());
-
var command = "SELECT * FROM Readings";
var readings = SqlOperator.GetReadings(command); @@ -67,7 +65,10 @@ namespace PollutometerWebApi.Controllers { if (reading != null) { - SqlOperator.PostReading(reading); + SqlOperator.PostReading(reading);
+ var aqi = AqiCalculator.CalculateAqi(reading);
+ if (aqi.Value > 151)
+ EmailSender.SendEmail(aqi); return Ok(); } else return BadRequest(); |