public async Task <ActionResult> DeletePolicy(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "the identifier must be specified", HttpStatusCode.BadRequest));
            }

            var isPolicyExists = await _policyActions.DeletePolicy(id);

            if (!isPolicyExists)
            {
                return(GetNotFoundPolicy());
            }

            await _representationManager.AddOrUpdateRepresentationAsync(this, Constants.CachingStoreNames.GetPolicyStoreName + id, false);

            return(new StatusCodeResult((int)HttpStatusCode.NoContent));
        }
Пример #2
0
        public async Task <ActionResult> DeletePolicy(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentNullException(nameof(id));
            }

            var isPolicyExists = await _policyActions.DeletePolicy(id);

            if (!isPolicyExists)
            {
                return(GetNotFoundPolicy());
            }

            await _representationManager.AddOrUpdateRepresentationAsync(this, CachingStoreNames.GetPolicyStoreName + id, false);

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

            return(new StatusCodeResult((int)HttpStatusCode.NoContent));
        }