public OperationDataResult <EntityGroupList> GetEntityGroupList(
     AdvEntitySelectableGroupListRequestModel requestModel)
 {
     try
     {
         eFormCore.Core  core  = _coreHelper.GetCore();
         EntityGroupList model = core.Advanced_EntityGroupAll(requestModel.Sort, requestModel.NameFilter,
                                                              requestModel.PageIndex, requestModel.PageSize, Constants.FieldTypes.EntitySelect,
                                                              requestModel.IsSortDsc,
                                                              Constants.WorkflowStates.NotRemoved);
         return(new OperationDataResult <EntityGroupList>(true, model));
     }
     catch (Exception)
     {
         return(new OperationDataResult <EntityGroupList>(false, LocaleHelper.GetString("SelectableGroupLoadingFailed")));
     }
 }
        private static async Task <int> CreateWorkerList(Core core)
        {
            EntityGroupList model = await core.Advanced_EntityGroupAll(
                "id",
                "eform-angular-work-orders-plugin-editable-Worker",
                0, 1, Constants.FieldTypes.EntitySelect,
                false,
                Constants.WorkflowStates.NotRemoved);

            if (!model.EntityGroups.Any())
            {
                var eg = await core.EntityGroupCreate(Constants.FieldTypes.EntitySelect,
                                                      "eform-angular-work-orders-plugin-editable-Worker", "Medarbejdere", true, true);

                return(int.Parse(eg.MicrotingUid));
            }

            return(int.Parse(model.EntityGroups.First().MicrotingUUID));
        }
        private async void SeedCustomersEntityGroup(IServiceCollection serviceCollection)
        {
            var serviceProvider = serviceCollection.BuildServiceProvider();
            var pluginDbOptions = serviceProvider.GetRequiredService <IPluginDbOptions <CustomersSettings> >();

            if (pluginDbOptions.Value.RelatedEntityGroupId == null)
            {
                var core = await serviceProvider.GetRequiredService <IEFormCoreService>().GetCore();

                var context = serviceProvider.GetRequiredService <CustomersPnDbAnySql>();


                EntityGroupList model = await core.Advanced_EntityGroupAll(
                    "id",
                    "eform-angular-basecustomer-plugin-Customers-hidden",
                    0, 1, Constants.FieldTypes.EntitySearch,
                    false,
                    Constants.WorkflowStates.NotRemoved);

                EntityGroup group;

                if (!model.EntityGroups.Any())
                {
                    group = await core.EntityGroupCreate(Constants.FieldTypes.EntitySearch,
                                                         "eform-angular-basecustomer-plugin-Customers-hidden", "");
                }
                else
                {
                    group = model.EntityGroups.First();
                }

                await pluginDbOptions.UpdateDb(
                    settings => settings.RelatedEntityGroupId = int.Parse(group.MicrotingUUID),
                    context,
                    1);
            }
        }