Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public SharedStateDto(SharedState sharedState)
 {
     CurrentSelectedSpace = sharedState.CurrentSelectedSpace;
 }
Ejemplo n.º 4
0
        public async Task <SharedState> GetSharedState([FromRoute] string anchorSetId)
        {
            SharedState sharedState = await _database.FindOne(a => a.Id == anchorSetId);

            return(sharedState);
        }