aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs29
1 files changed, 27 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index 6f5eed749..d8dc4a7b8 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -74,11 +74,32 @@ namespace Tango.MachineService.Controllers
throw new AuthenticationException("The specified serial number could not be found.");
}
- if (machine.SetupActivation && machine.OsKey == null)
+ if (machine.SetupActivation && String.IsNullOrWhiteSpace(machine.OsKey))
{
throw new InvalidDataException("The specified machine is configured to perform an OS activation but is not associated with an OS activation key.");
}
+ if (String.IsNullOrWhiteSpace(request.DeviceID))
+ {
+ throw new InvalidDataException("Device id not set.");
+ }
+
+ if (String.IsNullOrWhiteSpace(request.DeviceName))
+ {
+ throw new InvalidDataException("Device name not set.");
+ }
+
+ if (machine.IsDeviceRegistered && machine.DeviceId != request.DeviceID)
+ {
+ throw new InvalidDataException("The specified machine is already registered and device id is invalid.");
+ }
+
+ machine.DeviceName = request.DeviceName;
+ machine.DeviceId = request.DeviceID;
+ machine.IsDeviceRegistered = true;
+
+ db.SaveChanges();
+
var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid);
var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault();
@@ -122,7 +143,6 @@ namespace Tango.MachineService.Controllers
response.SetupUWF = machine.SetupUwf;
response.SetupFirmware = machine.SetupFirmware;
response.IsDemo = machine.IsDemo;
-
}
return response;
@@ -216,6 +236,11 @@ namespace Tango.MachineService.Controllers
}
response.Version = latest_machine_version.Version;
+
+ if (machine.ForceVersionUpdate)
+ {
+ response.IsUpdateAvailable = true;
+ }
}
}