public JsonResult Create(Contratistas contratista) { try { var cont = contratista.Crear(); for (var i = 1; i < contratista.telefonos.Count(); i++) { Telefonos t = new Telefonos(); t.Proveniente = "Contratista"; t.ProvenienteID = cont; t.TipoTelefono_fk = Convert.ToInt32(contratista.tipotelefono[i]); t.Telefono = contratista.telefonos[i]; t.Crear(); } return(Json(new { result = true })); } catch (Exception e) { return(Json(new { result = false, message = e.Message })); } }