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)); } }
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)); } }