/// <summary> /// Deletes the Multicode. /// </summary> /// <param name="details">The details.</param> /// <returns></returns> public async Task <APIResponse> DeleteMultiCode(MulticodeIdDetail details) { try { var client = httpClientFactory.CreateClient(ECommerceServiceOperation.serviceName); var response = await client.DeleteAsync(servicesConfig.ECommerce + ECommerceServiceOperation.DeleteMultiCode(details.Code)); return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'DeleteMultiCode()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }
/// <summary> /// Updates the Multicode. /// </summary> /// <param name="details">The details.</param> /// <param name="request">The request.</param> /// <returns></returns> public async Task <APIResponse> UpdateMultiCode(MulticodeIdDetail details, UpdateMulticodeEcommerceRequest request) { try { var client = httpClientFactory.CreateClient(ECommerceServiceOperation.serviceName); var param = JsonConvert.SerializeObject(request); HttpContent contentPost = new StringContent(param, Encoding.UTF8, "application/json"); var response = await client.PutAsync(servicesConfig.ECommerce + ECommerceServiceOperation.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)); } }
/// <summary> /// Gets the Multicode. /// </summary> /// <param name="details">The details.</param> /// <returns></returns> public async Task <APIResponse> GetMultiCode(MulticodeIdDetail details) { try { var client = httpClientFactory.CreateClient(ECommerceServiceOperation.serviceName); var response = await client.GetAsync(servicesConfig.ECommerce + ECommerceServiceOperation.GetMultiCode(details.Code)); if (response.IsSuccessStatusCode) { var multicode = JsonConvert.DeserializeObject <MulticodeResponseDetails>(await response.Content.ReadAsStringAsync()); return(new APIResponse(multicode, HttpStatusCode.OK)); } return(new APIResponse(response.StatusCode)); } catch (Exception ex) { logger.Error(ex, "Exception in method 'GetMultiCodeById()'"); var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message; return(new APIResponse(exMessage, HttpStatusCode.InternalServerError)); } }