public static InlineActionRepresentation Create(IOidStrategy oidStrategy, HttpRequest req, ActionContextFacade actionContext, RestControlFlags flags)
        {
            var consent = actionContext.Action.IsUsable(actionContext.Target);

            var strategy  = AbstractActionRepresentationStrategy.GetStrategy(true, oidStrategy, req, actionContext, flags);
            var optionals = new List <OptionalProperty>();

            if (consent.IsVetoed)
            {
                optionals.Add(new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason));
            }

            if (strategy.ShowParameters())
            {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Parameters, strategy.GetParameters()));
            }

            return(optionals.Any()
                ? CreateWithOptionals <InlineActionRepresentation>(new object[] { oidStrategy, strategy }, optionals)
                : new InlineActionRepresentation(oidStrategy, strategy));
        }
Exemple #2
0
        public static ActionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ActionContextFacade actionContext, RestControlFlags flags)
        {
            var actionRepresentationStrategy = AbstractActionRepresentationStrategy.GetStrategy(false, oidStrategy, req, actionContext, flags);

            return(new ActionRepresentation(oidStrategy, actionRepresentationStrategy));
        }