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()); }
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()); }
public static InlineActionRepresentation Create(HttpRequestMessage req, ActionContextSurface actionContext, RestControlFlags flags) { IConsentSurface consent = actionContext.Action.IsUsable(actionContext.Target); var actionRepresentationStrategy = new ActionRepresentationStrategy(req, actionContext, flags); if (consent.IsVetoed) { var optionals = new List<OptionalProperty> {new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason)}; return CreateWithOptionals<InlineActionRepresentation>(new object[] {actionRepresentationStrategy}, optionals); } return new InlineActionRepresentation(actionRepresentationStrategy); }