Example #1
0
        private async Task <(List <AccountClassification>, Extras)> SetIsActive(List <int> ids, ActionArguments args, bool isActive)
        {
            // Check user permissions
            var action       = "IsActive";
            var actionFilter = await UserPermissionsFilter(action, cancellation : default);

            ids = await CheckActionPermissionsBefore(actionFilter, ids);

            // Execute and return
            using var trx = ControllerUtilities.CreateTransaction();
            await _repo.AccountClassifications__Activate(ids, isActive);

            List <AccountClassification> data = null;
            Extras extras = null;

            if (args.ReturnEntities ?? false)
            {
                (data, extras) = await GetByIds(ids, args, action, cancellation : default);
            }

            // Check user permissions again
            await CheckActionPermissionsAfter(actionFilter, ids, data);

            trx.Complete();
            return(data, extras);
        }