Beispiel #1
0
        public void UpdateCup(string id, CupFormData cupUpdateData)
        {
            _dbService.UpdateCup(id, cupUpdateData);
            var cupConfig = Transform(id, cupUpdateData);

            _mqttConfigChannelWriter.WriteAsync(cupConfig);
        }
Beispiel #2
0
 public void UpdateCup(string id, CupFormData cup)
 {
     using (var connection = GetDbConnection())
     {
         var parameters = new
         { Id = id, DisplayName = cup.InputName, MaxTemp = cup.MaxTemp, MinTemp = cup.MinTemp };
         connection.Execute(sqlCupUpdate, parameters);
     }
 }
Beispiel #3
0
        private CupConfig Transform(string id, CupFormData cupFormData)
        {
            const double a = 0.0627918;
            const double b = -20.9698;
            var          maxTempTransformed = (cupFormData.MaxTemp - b) / a;
            var          minTempTransformed = (cupFormData.MinTemp - b) / a;

            return(new CupConfig {
                Id = id, MaxTemp = (int)maxTempTransformed, MinTemp = (int)minTempTransformed
            });
        }
Beispiel #4
0
 public ActionResult UpdateCup(string id, [FromForm] CupFormData cup)
 {
     _cupService.UpdateCup(id, cup);
     return(Redirect("/index.html"));
 }