Пример #1
0
        public async Task <UpdateJobStatusOutcome?> PutUpdateRequestStatusToCancelled(int requestId, int createdByUserId)
        {
            var request = new PutUpdateRequestStatusToCancelledRequest()
            {
                RequestID       = requestId,
                CreatedByUserID = createdByUserId
            };

            var response = await PutAsync <BaseRequestHelpResponse <PutUpdateRequestStatusToCancelledResponse> >($"/api/PutUpdateRequestStatusToCancelled", request);

            if (response.HasContent && response.IsSuccessful)
            {
                return(response.Content.Outcome);
            }
            return(null);
        }
Пример #2
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "put", Route = null)]
            [RequestBodyType(typeof(PutUpdateRequestStatusToCancelledRequest), "put update request status to cancelled")] PutUpdateRequestStatusToCancelledRequest req,
            CancellationToken cancellationToken)
        {
            try
            {
                _logger.LogInformation("PutUpdateRequestStatusToCancelled started");
                PutUpdateRequestStatusToCancelledResponse response = await _mediator.Send(req, cancellationToken);

                return(new OkObjectResult(ResponseWrapper <PutUpdateRequestStatusToCancelledResponse, RequestServiceErrorCode> .CreateSuccessfulResponse(response)));
            }
            catch (Exception exc)
            {
                _logger.LogErrorAndNotifyNewRelic("Exception occured in PutUpdateRequestStatusToCancelled", exc);
                return(new ObjectResult(ResponseWrapper <PutUpdateRequestStatusToCancelledResponse, RequestServiceErrorCode> .CreateUnsuccessfulResponse(RequestServiceErrorCode.InternalServerError, "Internal Error"))
                {
                    StatusCode = StatusCodes.Status500InternalServerError
                });
            }
        }