public static void update(Configuration config) { RestClient client = new RestClient(System.Configuration.ConfigurationManager.AppSettings["endpoint"]); RestRequest request = new RestRequest("configuration", Method.POST); request.AddParameter("application/json", config.Threshold, ParameterType.RequestBody); request.RequestFormat = DataFormat.Json; var response = client.Execute(request); if (response.StatusCode.Equals(HttpStatusCode.OK)) { try { LogBookController.register("Configuracion cambiada"); } catch { throw; } } }
protected void btnGuardar_Click(object sender, EventArgs e) { Configuration config = new Configuration(); config.Threshold = Convert.ToInt32(threshold.Text); ConfigurationService.update(config); }