public async Task <ActionResult> PostPolicy([FromBody] PostPolicy postPolicy)
        {
            if (postPolicy == null)
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "no parameter in body request", HttpStatusCode.BadRequest));
            }

            var policyId = await _policyActions.AddPolicy(postPolicy.ToParameter());

            var content = new AddPolicyResponse
            {
                PolicyId = policyId
            };

            return(new ObjectResult(content)
            {
                StatusCode = (int)HttpStatusCode.Created
            });
        }
Exemplo n.º 2
0
        public async Task <ActionResult> PostPolicy([FromBody] PostPolicy postPolicy)
        {
            if (postPolicy == null)
            {
                throw new ArgumentNullException(nameof(postPolicy));
            }

            var policyId = await _policyActions.AddPolicy(postPolicy.ToParameter());

            var content = new AddPolicyResponse
            {
                PolicyId = policyId
            };

            await _representationManager.AddOrUpdateRepresentationAsync(this, CachingStoreNames.GetPoliciesStoreName, false);

            return(new ObjectResult(content)
            {
                StatusCode = (int)HttpStatusCode.Created
            });
        }