Esempio n. 1
0
        public BrewTargetTemperature GetTargetTemp()
        {
            var t = _db.TargetTemp.FirstOrDefault();
            if (t != null)
            {
                return t;
            }
            t = new BrewTargetTemperature();
            t.Target1 = 20;
            t.Target2 = 20;
            _db.TargetTemp.Add(t);
            return t;

        }
Esempio n. 2
0
 public async void Post([FromBody]BrewTargetTemperature value)
 {
     using (var db = new BrewMaticContext())
     {
         var t = await db.TargetTemp.FirstOrDefaultAsync();
         if (t == null)
         {
             t = new BrewTargetTemperature();
             db.Add(t);
         }
         t.Target1 = value.Target1;
         t.Target2 = value.Target2;
         await db.SaveChangesAsync();
     }
 }
Esempio n. 3
0
 public async Task<BrewTargetTemperature> Get()
 {
     //todo! Return async data!!
     var logs = new List<BrewTempLog>();
     using (var db = new BrewMaticContext())
     {
         var t = await db.TargetTemp.FirstOrDefaultAsync();
         if (t != null)
             return t;
         t = new BrewTargetTemperature { Target1 = 20, Target2 = 20 };
         db.Add(t);
         await db.SaveChangesAsync();
         return t;
     }
 }