public async Task <IActionResult> UpdateSubcriptionPlan(int subscriptionplanId, [FromBody] UpdateSubscriptionPlanRequest request)
        {
            var result = await subscriptionService.UpdateSubcriptionPlan(subscriptionplanId, request);

            return(StatusCode((int)result.Code, result.Value));
        }
        public async Task <IActionResult> UpdateSubcriptionPlan(int subscriptionplanId, [FromBody] UpdateSubscriptionPlanRequest request)
        {
            var updateSubcriptionPlanCommand = new UpdateSubscriptionPlanCommand(subscriptionplanId, request);
            var result = await mediator.Send(updateSubcriptionPlanCommand);

            return(StatusCode((int)result.Code, result.Value));
        }
        public async Task <APIResponse> UpdateSubcriptionPlan(int subscriptionplanId, UpdateSubscriptionPlanRequest 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.UpdateSubcriptionPlan(subscriptionplanId), contentPost);

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

                return(JsonConvert.DeserializeObject <APIResponse>(await response.Content.ReadAsStringAsync()));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'UpdateSubcriptionPlan()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateSubscriptionPlanCommand" /> class.
 /// </summary>
 /// <param name="subscriptionPlanIdId">The story identifier.</param>
 /// <param name="Request">The request.</param>
 public UpdateSubscriptionPlanCommand(int subscriptionPlanIdId, UpdateSubscriptionPlanRequest request)
 {
     SubscriptionPlanId = subscriptionPlanIdId;
     Request            = request;
 }