private void crearDetallePlantilla(Plantilla pPlantilla)
        {
            List<int> ids = (List<int>)HttpContext.Current.Session["IdsPreguntaPlantilla"];
            List<Pregunta> preguntas = new List<Pregunta>();

            foreach (int valor in ids) {

                RestClient client = new RestClient(ConfigurationManager.AppSettings.Get("endpoint"));
                RestRequest request = new RestRequest("Preguntas/{id}", Method.GET);

                request.AddUrlSegment("id", Convert.ToString(valor));

                var response = client.Execute(request);

                string json = response.Content;

                Pregunta nuevaPregunta = JsonConvert.DeserializeObject<Pregunta>(json);

                preguntas.Add(nuevaPregunta);

            }

            RestClient client2 = new RestClient(ConfigurationManager.AppSettings.Get("endpoint"));

            foreach (Pregunta item in preguntas) {

                RestRequest request2 = new RestRequest("PlantillaDetalle/", Method.POST);
                PlantillaDetalle x = new PlantillaDetalle(0, pPlantilla, item);

                request2.AddJsonBody(x);

                var response = client2.Execute(request2);
                Console.WriteLine(response.Content.ToString());
            }
        }
 public PlantillaDetalle(int pID, Plantilla pPlantilla, Pregunta pPregunta)
 {
     PlantillaDetalleID = pID;
     Plantilla = pPlantilla;
     Pregunta = pPregunta;
 }
        private void crearPlantilla()
        {
            RestClient client = new RestClient(ConfigurationManager.AppSettings.Get("endpoint"));
            RestRequest request = new RestRequest("Plantillas/", Method.POST);

            Plantilla nuevaPlantilla = new Plantilla(0, txtDescPlantilla.Text);

            request.AddJsonBody(nuevaPlantilla);

            var response = client.Execute(request);

            request = new RestRequest("Plantillas/", Method.GET);

            response = client.Execute(request);

            string json = response.Content;

            List<Plantilla> plantillas = JsonConvert.DeserializeObject<List<Plantilla>>(json);

            nuevaPlantilla = plantillas[plantillas.Count-1];

            crearDetallePlantilla(nuevaPlantilla);

            Response.Redirect("GestionEvaluaciones.aspx");
        }