public async Task <RespBase <SalesInvoce_Resp> > Add(SalesInvoiceRegister_Req model) { var request = JsonConvert.SerializeObject(model); var content = new StringContent(request, Encoding.UTF8, "application/json"); var client = new HttpClient(); client.BaseAddress = new Uri(_urlBase); var url = string.Concat(_endPoint); var response = await client.PostAsync(url, content); var answer = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) { return(new RespBase <SalesInvoce_Resp> { IsSuccess = false, Code = (int)response.StatusCode, Message = "Error" }); } return(JsonConvert.DeserializeObject <RespBase <SalesInvoce_Resp> >(answer)); }
public ActionResult Add(SalesInvoiceRegister_Req model) { var response = Task.Run(() => proxy.Add(model)); return(Json(response, JsonRequestBehavior.AllowGet)); }