public async Task <ActionResult <SensorDto> > Adicionar(SensorDto sensorDto)
        {
            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }

            await _sensorService.Adicionar(_mapper.Map <Sensor>(sensorDto));

            return(CustomResponse(sensorDto));
        }
Example #2
0
        public async Task <ActionResult <SensorDTO> > Adicionar(SensorDTO sensorDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var sensor = _mapper.Map <Sensor>(sensorDTO);

            await _sensorService.Adicionar(sensor);

            await _hubContext.Clients.All.SendAsync("ReceiveMessage", sensor);


            return(Ok(sensor));
        }