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)); }
public static InlineMemberAbstractRepresentation Create(HttpRequestMessage req, PropertyContextSurface propertyContext, RestControlFlags flags) { IConsentSurface consent = propertyContext.Property.IsUsable(propertyContext.Target); var optionals = new List <OptionalProperty>(); if (consent.IsVetoed) { optionals.Add(new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason)); } if (propertyContext.Property.IsCollection()) { return(InlineCollectionRepresentation.Create(req, propertyContext, optionals, flags)); } return(InlinePropertyRepresentation.Create(req, propertyContext, optionals, flags)); }