public async Task RegisterWaterStateAsync(WaterStateRequestDto waterState) { await this._db.WaterStates.AddAsync(new WaterState { TimeStamp = DateTime.Parse(waterState.TimeStamp), WaterTemperature = waterState.WaterTemperature, Humidity = waterState.Humidity, Temperature = waterState.Temperature }); await this._db.SaveChangesAsync(); this._store.Aquarium.LatestTimeStamp.Value = DateTime.Parse(waterState.TimeStamp); this._store.Aquarium.LatestWaterTemperature.Value = waterState.WaterTemperature; this._store.Aquarium.LatestHumidity.Value = waterState.Humidity; this._store.Aquarium.LatestTemperature.Value = waterState.Temperature; }
public async Task <JsonResult> PostRegisterWaterState([FromBody] WaterStateRequestDto waterState) { await this._aquariumModel.RegisterWaterStateAsync(waterState); return(new JsonResult(true)); }