Fix: Delete Device Models
Also purge related Device Components and any Device Model Image
This commit is contained in:
@@ -91,6 +91,17 @@ namespace Disco.BI.Extensions
|
||||
if (!dm.CanDelete(dbContext))
|
||||
throw new InvalidOperationException("The state of this Device Model doesn't allow it to be deleted");
|
||||
|
||||
// Delete Image
|
||||
var deviceModelImagePath = dm.ImageFilePath();
|
||||
if (File.Exists(deviceModelImagePath))
|
||||
File.Delete(deviceModelImagePath);
|
||||
|
||||
// Delete any Device Model Components
|
||||
foreach (var deviceModelComponent in dbContext.DeviceComponents.Where(dc => dc.DeviceModelId == dm.Id).ToList())
|
||||
{
|
||||
dbContext.DeviceComponents.Remove(deviceModelComponent);
|
||||
}
|
||||
|
||||
// Delete Model
|
||||
dbContext.DeviceModels.Remove(dm);
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0207.1727")]
|
||||
[assembly: AssemblyFileVersion("1.2.0207.1727")]
|
||||
[assembly: AssemblyVersion("1.2.0207.1853")]
|
||||
[assembly: AssemblyFileVersion("1.2.0207.1853")]
|
||||
|
||||
Reference in New Issue
Block a user