コード例 #1
0
        /// <summary>
        /// Updates the multi code.
        /// </summary>
        /// <param name="code">The multicode identifier.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public async Task <APIResponse> UpdateMultiCode(string code, UpdateMultiCodeVendorRequest 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.UpdateMultiCode(code), contentPost);

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'UpdateMultiCode()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
コード例 #2
0
        public async Task <IActionResult> UpdateMultiCode(string code, [FromBody] UpdateMultiCodeVendorRequest request)
        {
            var result = await multiCodeService.UpdateMultiCode(code, request);

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