public async Task <StatusCodeResult> TogglePanelForDevice([FromRoute] string anchorSetId, [FromRoute] string deviceId, [FromRoute] bool toggled) { SharedState existingSharedState = await GetSharedState(anchorSetId); if (existingSharedState == null) { return(new NotFoundResult()); } throw new NotImplementedException(); }
public async Task UpdateSharedState([FromRoute] string anchorSetId, [FromBody] SharedStateDto newState) { SharedState existingSharedState = await GetSharedState(anchorSetId) ?? new SharedState() { Id = anchorSetId, CreatedAt = _clock.GetCurrentInstant(), ToggledSensorPanels = new Dictionary <string, bool>() }; existingSharedState.CurrentSelectedSpace = newState.CurrentSelectedSpace; existingSharedState.UpdatedAt = _clock.GetCurrentInstant(); existingSharedState.ToggledSensorPanels = newState.ToggledSensorPanels; await _database.ReplaceOneAsync(s => s.Id == anchorSetId, existingSharedState); }
public SharedStateDto(SharedState sharedState) { CurrentSelectedSpace = sharedState.CurrentSelectedSpace; }
public async Task <SharedState> GetSharedState([FromRoute] string anchorSetId) { SharedState sharedState = await _database.FindOne(a => a.Id == anchorSetId); return(sharedState); }