Ejemplo n.º 1
0
        public Task <object> UpdateOffering(UpdateOfferingDto updateOfferingDto)
        {
            if (updateOfferingDto == null || string.IsNullOrEmpty(updateOfferingDto.offeringId))
            {
                throw new ArgumentException(
                          "Please check the offering object properties. Object can not be null or empty");
            }

            var data = new UpdateOfferingRequest
            {
                providerId          = string.IsNullOrEmpty(updateOfferingDto.providerId) ? SmaxHcmOptions.ProviderId : updateOfferingDto.providerId,
                service             = updateOfferingDto.service,
                offeringDisplayName = updateOfferingDto.offeringDisplayName,
                offeringId          = updateOfferingDto.offeringId
            };

            return(SendSmaxHcm <Object>(HttpMethod.Post, string.Format(SmaxHcmEndpointConst.CreateNewOffering, SmaxHcmOptions.TenantId), data));
        }
 public async Task <IActionResult> UpdateOffering(UpdateOfferingDto offeringRequestDto)
 {
     Devon4NetLogger.Debug("Getting service definitions from controller SmaxHcm");
     return(Ok(await SmaxHcmHandler.UpdateOffering(offeringRequestDto)));
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> UpdateOfferingAsync([FromRoute, Required] string productKey, [FromRoute, Required] string offeringKey, [FromBody] UpdateOfferingDto request)
        {
            try
            {
                var updateOfferingCommand = new UpdateOfferingCommand(productKey, offeringKey, request.ChangeEffectiveDate ?? DateTime.UtcNow,
                                                                      request.OfferingFormatCode, request.OfferingPlatformCode, request.OfferingStatusCode, request.OfferingEdition);

                await _mediator.Send(updateOfferingCommand);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Something went wrong in UpdateOfferingAsync");

                var errorResponse = new ProblemDetails()
                {
                    Title  = "An unexpected error occurred. Please try again later.",
                    Status = StatusCodes.Status500InternalServerError,
                    Detail = ex.Message
                };

                return(StatusCode(StatusCodes.Status500InternalServerError, errorResponse));
            }
        }