Example #1
0
        public IHttpActionResult Put(Sensor sensor)
        {
            var sensorToUpdate = _sensorService.GetById(sensor.Id);

            if (sensorToUpdate == null)
            {
                return(NotFound());
            }

            sensorToUpdate.Status = sensor.Status;

            _sensorService.Update(sensorToUpdate);

            return(Ok(sensorToUpdate));
        }
Example #2
0
        public async Task <ActionResult <SensorResponse> > GetById(Guid id)
        {
            var result = await _service.GetById(id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(_converter.ToSensorResponse(result)));
        }