Skip to content

Commit ee8dece

Browse files
committed
Fixing EntityGroup issue.
1 parent df48d63 commit ee8dece

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

eFormAPI/Plugins/Customers.Pn/Customers.Pn/EformCustomersPlugin.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Reflection;
5+
using System.Threading.Tasks;
56
using Customers.Pn.Abstractions;
67
using Customers.Pn.Infrastructure.Data.Seed;
78
using Customers.Pn.Infrastructure.Data.Seed.Data;
@@ -251,7 +252,7 @@ public PluginPermissionsManager GetPermissionsManager(string connectionString)
251252
return new PluginPermissionsManager(context);
252253
}
253254

254-
private async void SeedCustomersEntityGroup(IServiceCollection serviceCollection)
255+
private async Task SeedCustomersEntityGroup(IServiceCollection serviceCollection)
255256
{
256257
var serviceProvider = serviceCollection.BuildServiceProvider();
257258
var pluginDbOptions = serviceProvider.GetRequiredService<IPluginDbOptions<CustomersSettings>>();
@@ -261,30 +262,32 @@ private async void SeedCustomersEntityGroup(IServiceCollection serviceCollection
261262
var core = await serviceProvider.GetRequiredService<IEFormCoreService>().GetCore();
262263
var context = serviceProvider.GetRequiredService<CustomersPnDbAnySql>();
263264

264-
265265
EntityGroupList model = await core.Advanced_EntityGroupAll(
266266
"id",
267267
"eform-angular-basecustomer-plugin-Customers-hidden",
268268
0, 1, Constants.FieldTypes.EntitySearch,
269269
false,
270270
Constants.WorkflowStates.NotRemoved);
271271

272-
EntityGroup group;
273-
274272
if (!model.EntityGroups.Any())
275273
{
276-
group = await core.EntityGroupCreate(Constants.FieldTypes.EntitySearch,
277-
"eform-angular-basecustomer-plugin-Customers-hidden", "", true, false);
274+
var group = await core.EntityGroupCreate(Constants.FieldTypes.EntitySearch,
275+
"eform-angular-basecustomer-plugin-Customers-hidden", "", true, true);
276+
277+
await pluginDbOptions.UpdateDb(
278+
settings => settings.RelatedEntityGroupId = int.Parse(group.MicrotingUid),
279+
context,
280+
1);
278281
}
279282
else
280283
{
281-
group = model.EntityGroups.First();
282-
}
284+
var group = model.EntityGroups.First();
283285

284-
await pluginDbOptions.UpdateDb(
285-
settings => settings.RelatedEntityGroupId = int.Parse(group.MicrotingUUID),
286-
context,
287-
1);
286+
await pluginDbOptions.UpdateDb(
287+
settings => settings.RelatedEntityGroupId = int.Parse(group.MicrotingUUID),
288+
context,
289+
1);
290+
}
288291
}
289292
}
290293
}

0 commit comments

Comments
 (0)