public ActionResult Create([Bind(Include = "ItemID,TextoPregunta,TieneObservacion,TipoPregunta,NombreCategoria,EtiquetaObservacion")] Item item, string[] DynamicTextBox) { if (ModelState.IsValid) { db.Item.Add(item); db.SaveChanges(); if (DynamicTextBox != null && item.TipoPregunta == 2) { //Uso del procedimiento almacenado para insertar en una sección. db.SP_Insertar_Seleccion_Unica(item.ItemId, false); //Uso del procedimiento almancenado para insertar todas las opciones de respuesta en la tabla Selección Única. for (short index = 1; index <= DynamicTextBox.Length; ++index) { db.SP_Insertar_Opciones_De_Respuestas_Seleccion_Unica(item.ItemId, index, DynamicTextBox[index - 1]); } } ViewBag.ItemID = new SelectList(db.Seleccion_Unica, "ItemID", "ItemID", item.ItemId); ViewBag.ItemID = new SelectList(db.Texto_Libre, "ItemId", "ItemId", item.ItemId); return(RedirectToAction("Index")); } return(View("Create", item)); }