Skip to content

Commit 5d12f2d

Browse files
andreasbFraser Greenroyd
authored andcommitted
Added override to Delete method in toolkit. Thereby allowing deletion of elements by id.
1 parent cf19d53 commit 5d12f2d

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

SAP2000_Adapter/CRUD/Delete/_IDelete.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System.Collections.Generic;
3333
using System.Linq;
3434
using BH.oM.Adapter;
35+
using BH.oM.Data.Requests;
3536

3637
namespace BH.Adapter.SAP2000
3738
{
@@ -70,6 +71,26 @@ protected override int IDelete(Type type, IEnumerable<object> ids, ActionConfig
7071
}
7172

7273
/***************************************************/
74+
75+
protected override int Delete(FilterRequest request, ActionConfig actionConfig = null)
76+
{
77+
// Get object ids
78+
List<object> objectIds = new List<object>();
79+
object idObject;
80+
if (request.Equalities.TryGetValue("ObjectIds", out idObject))
81+
82+
{
83+
objectIds = (List<object>)idObject;
84+
85+
// Delete
86+
return IDelete(request.Type, objectIds, actionConfig);
87+
}
88+
89+
return 0;
90+
91+
}
92+
93+
/***************************************************/
7394
}
7495
}
7596

SAP2000_Adapter/SAP2000_Adapter.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
@@ -266,4 +266,4 @@
266266
<Target Name="AfterBuild">
267267
</Target>
268268
-->
269-
</Project>
269+
</Project>

0 commit comments

Comments
 (0)