Пример #1
0
        public ActionResult Match(List <ParticipanteAprender> listaparticipanteaprender)
        {
            JsonResult jsonResult;

            //Verifica se o registro é inválido e se sim, retorna com erro.
            if (listaparticipanteaprender == null)
            {
                jsonResult = Json(new
                {
                    listaparticipanteaprender = ""
                }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                if (this.GestorDeParticipanteAprender.VerificarSeExisteAprendizadoDeParticipantePorIdDeItem(listaparticipanteaprender[0].CodItem))
                {
                    try
                    {
                        List <MA_PARTICIPANTE_APRENDER> listapaprender = this.GestorDeParticipanteAprender.ObterTodosOsAprendizadoDeParticipantePorPorItemPaginadosPorVinteRegistros(listaparticipanteaprender[0].CodItem);

                        //Reinicia lista de aprendizado de participante
                        listaparticipanteaprender = new List <ParticipanteAprender>();

                        foreach (MA_PARTICIPANTE_APRENDER mapa in listapaprender)
                        {
                            ParticipanteAprender pa = new ParticipanteAprender();

                            pa.CodPAprender    = mapa.cod_p_aprender;
                            pa.CodItem         = mapa.cod_item;
                            pa.CodParticipante = mapa.cod_participante;

                            listaparticipanteaprender.Add(pa);
                        }

                        jsonResult = Json(new
                        {
                            listaparticipanteaprender = listaparticipanteaprender
                        }, JsonRequestBehavior.AllowGet);
                    }
                    catch (Exception e)
                    {
                        jsonResult = Json(new
                        {
                            erro = e.InnerException.ToString(),
                            listaparticipanteaprender = ""
                        }, JsonRequestBehavior.AllowGet);
                    }
                }
                else
                {
                    jsonResult = Json(new
                    {
                        listaparticipanteaprender = ""
                    }, JsonRequestBehavior.AllowGet);
                }
            }

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }
Пример #2
0
        public ActionResult List()
        {
            List <MA_PARTICIPANTE_APRENDER> listaparticipanteaprenderoriginal = GestorDeParticipanteAprender.ObterTodosOsRegistros();
            List <ParticipanteAprender>     listaparticipanteaprender         = new List <ParticipanteAprender>();

            foreach (MA_PARTICIPANTE_APRENDER pe in listaparticipanteaprenderoriginal)
            {
                ParticipanteAprender participanteaprender = new ParticipanteAprender();

                participanteaprender.cod_p_aprender   = pe.cod_p_aprender;
                participanteaprender.cod_participante = pe.cod_participante;
                participanteaprender.cod_item         = pe.cod_item;
                participanteaprender.cod_s_relacao    = pe.cod_s_relacao;

                listaparticipanteaprender.Add(participanteaprender);
            }

            JsonResult jsonResult = Json(new
            {
                data = listaparticipanteaprender
            }, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }