public async Task <IActionResult> DeleteDeviceType(int id) { var deviceType = await _deviceTypeService.GetDeviceTypeByIdAsync(id); if (deviceType == null) { return(NotFound()); } if (await _deviceTypeService.DeleteDeviceTypeAsync(deviceType)) { return(NoContent()); } throw new Exception($"Deleting device type {id} failed on save"); }