Example #1
0
        public async Task <ActionResult <IEnumerable <SensorDTO> > > CreateSensors(
            [FromBody] CreateWallDTO createWallDTO)
        {
            try
            {
                var sensors = await sensorService.CreateAsync(createWallDTO);

                return(Ok(sensors));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Example #2
0
        public async Task <IActionResult> Post(CreateSensorRequest request)
        {
            if (OrganisationId == Guid.Empty)
            {
                return(Forbid());
            }
            var sensorDto = _mapper.Map <SensorDto>(request);

            sensorDto.Status         = DeviceStatus.Enabled;
            sensorDto.OrganisationId = OrganisationId;
            await _sensorService.CreateAsync(sensorDto);

            return(Ok());
        }