Exemple #1
0
 protected ActionRepresentation(ActionRepresentationStrategy strategy) : base(strategy.GetFlags())
 {
     SelfRelType = strategy.GetSelf();
     Id          = strategy.GetId();
     Parameters  = strategy.GetParameters();
     Links       = strategy.GetLinks(true);
     Extensions  = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
 protected InlineActionRepresentation(ActionRepresentationStrategy strategy) : base(strategy.GetFlags())
 {
     MemberType = MemberTypes.Action;
     Id         = strategy.GetId();
     Parameters = strategy.GetParameters();
     Links      = strategy.GetLinks(false);
     Extensions = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
        public static InlineActionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ActionContextFacade actionContext, RestControlFlags flags)
        {
            IConsentFacade consent = actionContext.Action.IsUsable(actionContext.Target);

            var actionRepresentationStrategy = new ActionRepresentationStrategy(oidStrategy, req, actionContext, flags);

            if (consent.IsVetoed)
            {
                var optionals = new List <OptionalProperty> {
                    new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason)
                };
                return(CreateWithOptionals <InlineActionRepresentation>(new object[] { oidStrategy, actionRepresentationStrategy }, optionals));
            }

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