Example #1
0
        public static OperationDto ToOperationDto(this Operation operation)
        {
            var to = new OperationDto {
                Name         = operation.Name,
                ResponseName = operation.IsOneWay ? null : operation.ResponseType.Name,
                ServiceName  = operation.ServiceType.Name,
                Actions      = operation.Actions,
                Routes       = operation.Routes.ToDictionary(x => x.Path.PairWith(x.AllowedVerbs)),
            };

            if (operation.RestrictTo != null)
            {
                to.RestrictTo = operation.RestrictTo.AccessibleToAny.ToList().ConvertAll(x => x.ToString());
                to.VisibleTo  = operation.RestrictTo.VisibleToAny.ToList().ConvertAll(x => x.ToString());
            }

            return(to);
        }
Example #2
0
        public static OperationDto ToOperationDto(this Operation operation)
        {
            var to = new OperationDto {
                Name = operation.Name,
                ResponseName = operation.IsOneWay ? null : operation.ResponseType.Name,
                ServiceName = operation.ServiceType.Name,
                Actions = operation.Actions,
                Routes = operation.Routes.ToDictionary(x => x.Path.PairWith(x.AllowedVerbs)),
            };
            
            if (operation.RestrictTo != null)
            {
                to.RestrictTo = operation.RestrictTo.AccessibleToAny.ToList().ConvertAll(x => x.ToString());
                to.VisibleTo = operation.RestrictTo.VisibleToAny.ToList().ConvertAll(x => x.ToString());
            }

            return to;
        }