Bug Fix #97 - Removed Organisation Address References

Remove Device Profile references to an address when its removed, and
anticipate missing addresses where referenced.
This commit is contained in:
Gary Sharp
2016-11-03 16:47:07 +11:00
parent 3e4dda683d
commit 6df2e16a7f
7 changed files with 29 additions and 22 deletions
@@ -26,7 +26,7 @@ namespace Disco.Web.Areas.Public.Models.UserHeldDevices
ReadyForReturn = this.ReadyForReturn,
WaitingForUserAction = this.WaitingForUserAction,
DeviceProfileId = this.DeviceProfileId,
DeviceAddress = (this.DeviceAddressId.HasValue ? Database.DiscoConfiguration.OrganisationAddresses.GetAddress(this.DeviceAddressId.Value).ShortName : string.Empty)
DeviceAddress = (this.DeviceAddressId.HasValue ? Database.DiscoConfiguration.OrganisationAddresses.GetAddress(this.DeviceAddressId.Value)?.ShortName : string.Empty)
};
var n = DateTime.Now;
if (!this.ReadyForReturn && this.EstimatedReturnTime.HasValue && this.EstimatedReturnTime.Value > n)