コード例 #1
0
        /// <summary>
        /// Updates the subcription benefit.
        /// </summary>
        /// <param name="subcriptionbenefitId">The subcriptionbenefit identifier.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public async Task <APIResponse> UpdateSubcriptionBenefit(int subcriptionbenefitId, UpdateSubscriptionBenefitRequest request)
        {
            try
            {
                var client = httpClientFactory.CreateClient(VendorServiceOperation.serviceName);

                var         param       = JsonConvert.SerializeObject(request);
                HttpContent contentPost = new StringContent(param, Encoding.UTF8, "application/json");

                var response = await client.PutAsync(servicesConfig.Vendor +
                                                     VendorServiceOperation.UpdateSubcriptionBenefit(subcriptionbenefitId), contentPost);

                if (response.StatusCode == HttpStatusCode.NoContent)
                {
                }

                return(JsonConvert.DeserializeObject <APIResponse>(await response.Content.ReadAsStringAsync()));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'UpdateSubcriptionBenefit()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
コード例 #2
0
        public async Task <IActionResult> UpdateSubcriptionBenefit(int subcriptionbenefitId, [FromBody] UpdateSubscriptionBenefitRequest request)
        {
            var updateSubcriptionBenefitCommand = new UpdateSubscriptionBenefitCommand(subcriptionbenefitId, request);
            var result = await mediator.Send(updateSubcriptionBenefitCommand);

            return(StatusCode((int)result.Code, result.Value));
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateSubscriptionBenefitCommand" /> class.
 /// </summary>
 /// <param name="subscriptionPlanIdId">The story identifier.</param>
 /// <param name="Request">The request.</param>
 public UpdateSubscriptionBenefitCommand(int subscriptionBenefitId, UpdateSubscriptionBenefitRequest request)
 {
     SubscriptionBenefitId = subscriptionBenefitId;
     Request = request;
 }
コード例 #4
0
        public async Task <IActionResult> UpdateSubcriptionBenefit(int subcriptionbenefitId, [FromBody] UpdateSubscriptionBenefitRequest request)
        {
            var result = await subscriptionBenefitService.UpdateSubcriptionBenefit(subcriptionbenefitId, request);

            return(StatusCode((int)result.Code, result.Value));
        }