Esempio n. 1
0
        //[Authorize(Roles = "Admin, Vendor")]
        public async Task <IActionResult> UpdateWalletAdjustment(int walletAdjustmentId, [FromBody] UpdateWalletAdjustmentRequest request)
        {
            var result = await walletAdjustmentService.UpdateWalletAdjustment(new WalletAdjustmentIdDetails(walletAdjustmentId), request);

            return(StatusCode((int)result.Code, result.Value));
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the WalletAdjustment.
        /// </summary>
        /// <param name="details">The details.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public async Task <APIResponse> UpdateWalletAdjustment(WalletAdjustmentIdDetails details, UpdateWalletAdjustmentRequest request)
        {
            try
            {
                var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName);

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

                var response = await client.PutAsync(servicesConfig.Wallet + WalletServiceOperation.UpdateWalletAdjustment(details.WalletAdjustmentId), contentPost);

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'UpdateWalletAdjustment()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
        public async Task <IActionResult> UpdateWalletAdjustment(int walletAdjustmentId, [FromBody] UpdateWalletAdjustmentRequest request)
        {
            var updateWalletAdjustmentCommand = new UpdateWalletAdjustmentCommand(walletAdjustmentId, request);
            var result = await mediator.Send(updateWalletAdjustmentCommand);

            return(StatusCode((int)result.Code, result.Value));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateWalletAdjustmentCommand" /> class.
 /// </summary>
 /// <param name="walletAdjustmentId">The Wallet Adjustment identifier.</param>
 /// <param name="Request">The request.</param>
 public UpdateWalletAdjustmentCommand(int walletAdjustmentId, UpdateWalletAdjustmentRequest request)
 {
     WalletAdjustmentId = walletAdjustmentId;
     Request            = request;
 }