コード例 #1
0
        public async Task <ActionResult <string> > AddNewDevice(DeviceDTO[] devices)
        {
            try
            {
                var deviceTag = await _deviceHandler.AddNewDevice(devices);

                return(Ok(deviceTag));
            }
            catch (Exception ex)
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }
コード例 #2
0
        public async Task <ActionResult <string> > AddNewDevice([FromBody] DeviceDTO device)
        {
            try
            {
                if (device != null)
                {
                    var deviceTag = await _deviceHandler.AddNewDevice(device);

                    return(Ok(deviceTag));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }