示例#1
0
        /// <summary>
        /// Updates the Multicode.
        /// </summary>
        /// <param name="details">The details.</param>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public async Task <APIResponse> UpdateMultiCode(MulticodeIdDetails details, UpdateMulticodeLeadRequest request)
        {
            try
            {
                var client = httpClientFactory.CreateClient(LeadServiceOperation.serviceName);

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

                var response = await client.PutAsync(servicesConfig.Lead + LeadServiceOperation.UpdateMultiCode(details.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));
            }
        }
        //[Authorize(Roles = "Admin, Vendor")]
        public async Task <IActionResult> UpdateMultiCode(string code, [FromBody] UpdateMulticodeLeadRequest request)
        {
            var result = await multicodeService.UpdateMultiCode(new MulticodeIdDetails(code), request);

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