コード例 #1
0
        public async Task <ActionResult> PostPermission([FromBody] PostPermission postPermission)
        {
            if (postPermission == null)
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "no parameter in body request", HttpStatusCode.BadRequest));
            }

            var parameter = postPermission.ToParameter();
            var clientId  = this.GetClientId();

            if (string.IsNullOrWhiteSpace(clientId))
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "the client_id cannot be extracted", HttpStatusCode.BadRequest));
            }

            var ticketId = await _permissionControllerActions.Add(parameter, clientId);

            var result = new AddPermissionResponse
            {
                TicketId = ticketId
            };

            return(new ObjectResult(result)
            {
                StatusCode = (int)HttpStatusCode.Created
            });
        }
コード例 #2
0
        public async Task <ActionResult> PostPermission([FromBody] PostPermission postPermission)
        {
            if (postPermission == null)
            {
                throw new ArgumentNullException(nameof(postPermission));
            }

            var parameter = postPermission.ToParameter();
            var clientId  = this.GetClientId();
            var ticketId  = await _permissionControllerActions.Add(parameter, clientId);

            var result = new AddPermissionResponse
            {
                TicketId = ticketId
            };

            return(new ObjectResult(result)
            {
                StatusCode = (int)HttpStatusCode.Created
            });
        }
コード例 #3
0
        public async Task <ActionResult> PostPermission([FromBody] PostPermission postPermission)
        {
            if (postPermission == null)
            {
                return(BuildError(ErrorCodes.InvalidRequestCode, "no parameter in body request", HttpStatusCode.BadRequest));
            }

            var audiences = GetAudiences();
            var parameter = postPermission.ToParameter();
            var ticketId  = await _permissionControllerActions.Add(audiences, parameter);

            var result = new AddPermissionResponse
            {
                TicketId = ticketId
            };

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