Disco.Services.DeviceBatchExtensions.Delete C# (CSharp) Method

Delete() public static method

public static Delete ( this db, DiscoDataContext Database ) : void
db this
Database Disco.Data.Repository.DiscoDataContext
return void
        public static void Delete(this DeviceBatch db, DiscoDataContext Database)
        {
            if (!db.CanDelete(Database))
                throw new InvalidOperationException("The state of this Device Batch doesn't allow it to be deleted");

            // Remove Linked Group
            ActiveDirectory.Context.ManagedGroups.Remove(DeviceBatchDevicesManagedGroup.GetKey(db));
            ActiveDirectory.Context.ManagedGroups.Remove(DeviceBatchAssignedUsersManagedGroup.GetKey(db));

            // Delete Batch
            Database.DeviceBatches.Remove(db);
        }
    }
DeviceBatchExtensions