public ServiceResponse PostOrderToMapicsAsync(ERPOrderInfo orderArray) { if (orderArray == null) { return(Response); } var httpClient = SetUpHeadersAndAuthentication(); using (httpClient) { try { var url = Utilities.Config("PostOrdersUrl"); var httpResponseMsg = httpClient.PostAsJsonAsync(url, orderArray).Result; using (var responseHelper = new HttpResponseHelper(httpResponseMsg)) { Response = httpResponseMsg.IsSuccessStatusCode ? responseHelper.GetPostOrdersApiResponse() : responseHelper.GetAppropriateResponseMessage(http_failure_post_order); } } catch (Exception ex) { Response.Messages.AddError(ex.Message); return(Response); } } return(Response); }
public ServiceResponse GetOrderInfoFromMapicsAsync(string customerNum, string poNum) { if (string.IsNullOrWhiteSpace(customerNum) || string.IsNullOrWhiteSpace(poNum)) { return(Response); } var httpClient = SetUpHeadersAndAuthentication(); using (httpClient) { try { var url = Utilities.Config("GetByPOandCustomerUrl"); var httpResponseMsg = httpClient.GetAsync(url + customerNum + "/pono/" + poNum).Result; using (var responseHelper = new HttpResponseHelper(httpResponseMsg)) { Response = httpResponseMsg.IsSuccessStatusCode ? responseHelper.GetOrderInfoApiResponse() : responseHelper.GetAppropriateResponseMessage(http_failure_get_order); } } catch (Exception ex) { Response.Messages.AddError(ex.Message); return(Response); } } return(Response); }