コード例 #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();
        }
コード例 #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);
        }
コード例 #3
0
 public SharedStateDto(SharedState sharedState)
 {
     CurrentSelectedSpace = sharedState.CurrentSelectedSpace;
 }
コード例 #4
0
        public async Task <SharedState> GetSharedState([FromRoute] string anchorSetId)
        {
            SharedState sharedState = await _database.FindOne(a => a.Id == anchorSetId);

            return(sharedState);
        }