Beispiel #1
0
        public static LatchOperationDto ToDto(this LatchOperation operation)
        {
            var dto = new LatchOperationDto
            {
                Id              = operation.Id,
                OperationId     = operation.OperationId,
                Name            = operation.Name,
                Type            = operation.Type,
                Action          = operation.Action,
                ApplyToAllUsers = operation.ApplyToAllUsers,
                ApplyToAllNodes = operation.ApplyToAllNodes
            };

            if (operation.UserIds != null && operation.UserIds.Any())
            {
                dto.Users.AddRange(operation.UserIds.Select(x => new LatchOperationUserDto {
                    Id = x
                }));
            }

            if (operation.NodeIds != null && operation.NodeIds.Any())
            {
                dto.Nodes = operation.NodeIds;
            }

            return(dto);
        }
Beispiel #2
0
        private bool LatchApplyToUser(LatchOperationDto latch, int userId)
        {
            if (latch.ApplyToAllUsers)
            {
                return(true);
            }

            var latchApplyToUser = latch.Users.Any(x => x.Id.Equals(userId));

            return(latchApplyToUser);
        }