private async Task CheckMode() { var mode = await GetIrrigationMode(1); irrigationMode = mode.Mode; var farmZones = await GetFarmZones(); switch (irrigationMode) { case IrrigationModeEnum.Automatic: { await CheckActuatorsInFarmZone(farmZones); break; } case IrrigationModeEnum.Manual: { await ManualModeActive(farmZones); break; } } }
private async Task SetIrrigationMode(int farmZoneId, IrrigationModeEnum mode) { irrigationMode = mode; var modeDb = await GetIrrigationMode(farmZoneId); modeDb.Mode = mode; var json = JsonConvert.SerializeObject(modeDb, jsonOptions); var data = new StringContent(json, Encoding.UTF8, "application/json"); await client.PutAsync(baseUrlApi + "/irrigationModes", data); }