public ActionResult Update(SalesInvoce_Req model) { var response = Task.Run(() => proxy.Update(model)); string message = response.Result.Message; return(Json(new { Message = message, JsonRequestBehavior.AllowGet })); }
public async Task <RespBase <SalesInvoce_Resp> > Add(SalesInvoce_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 = client.PostAsync(url, content).Result; if (response.StatusCode == HttpStatusCode.OK) { var result = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <RespBase <SalesInvoce_Resp> >(result)); } else { return(new RespBase <SalesInvoce_Resp> { IsSuccess = false, Code = (int)response.StatusCode, Message = "Error" }); } }