示例#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));
        }
示例#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)));
        }