public static async Task <HttpResponseMessage> UpdateRollo(RolloModel rollo) { HttpClient httpClient = new HttpClient(); var uri = new UrlMain(); string url = string.Concat(uri.UrlM, "rollos/?id=", rollo.Idrollo); String js = JsonConvert.SerializeObject(rollo); HttpContent httpContent = new StringContent(js); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await httpClient.PutAsync(url, httpContent).ConfigureAwait(false); return(response); }
public static async Task <HttpResponseMessage> SaveSwatch(List <SwatchModel> obj) { HttpClient httpClient = new HttpClient(); var uri = new UrlMain(); string url = string.Concat(uri.UrlM, "Swatches/"); String js = JsonConvert.SerializeObject(obj); HttpContent httpContent = new StringContent(js); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await httpClient.PostAsync(url, httpContent).ConfigureAwait(false); return(response); }
public static async Task <List <RolloModel> > GetRollosXidContenedor_ancho(int idcontenedor) { HttpClient httpClient = new HttpClient(); var uri = new UrlMain(); string url = string.Concat(uri.UrlM, "rollos/ancho/?", "idcontenedor=", idcontenedor.ToString()); var response = await httpClient.GetAsync(url).ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var rollos = RolloModel.FromJson(json); return(rollos); } return(null); }
public static async Task <List <ContenedorModel> > GetContenedor() { HttpClient httpClient = new HttpClient(); var uri = new UrlMain(); string url = string.Concat(uri.UrlM, "contenedors/"); var response = await httpClient.GetAsync(url).ConfigureAwait(false); if (response.StatusCode == System.Net.HttpStatusCode.OK) { var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); var contenedor = ContenedorModel.FromJson(json); return(contenedor); } return(null); }