예제 #1
0
        public IHttpActionResult ObterConteudoHome()
        {
            using (var db = new ModeloDados())
            {
                //Stopwatch swAudio = Stopwatch.StartNew();
                var audios = AudiosService.ObterAudios();
                //TimeSpan audioTime = swAudio.Elapsed;

                //Stopwatch swColunista = Stopwatch.StartNew();
                var colunistas = ColunistasService.ObterColunistas();
                //TimeSpan colunistaTime = swColunista.Elapsed;

                //Stopwatch swPublicidade = Stopwatch.StartNew();
                var publicidade = PublicidadesService.ObterPublicidadesPrincipais();
                //TimeSpan publicidadeTime = swPublicidade.Elapsed;

                //Stopwatch swNoticia = Stopwatch.StartNew();
                var noticias = NoticiasService.ObterNoticiasHome();
                //TimeSpan noticiaTime = swNoticia.Elapsed;

                var esportes = noticias.Take(3).ToList();
                var gerais   = noticias.Skip(3).Take(3).ToList();

                var homeModel = new HomeViewModel {
                    Audios = audios, Colunistas = colunistas, Noticias = gerais, Esportes = esportes, Publicidade = publicidade
                };

                //return Json("Audio: " + audioTime + " Colunistas: " + colunistaTime + " Publicidade: " + publicidadeTime + " Noticias: " + noticiaTime);
                return(Json(homeModel));
            }
        }
예제 #2
0
        public IHttpActionResult BuscarConteudo(string chave = null)
        {
            var audios     = AudiosService.ObterAudios(chave);
            var colunistas = ColunistasService.ObterColunistas(null, chave);
            var noticias   = NoticiasService.ObterNoticias(null, chave);
            var postagens  = PostagensService.ObterPostagens(null, null, chave);

            var buscarViewModel = new BuscarViewModel {
                Audios = audios, Colunistas = colunistas, Noticias = noticias, Postagens = postagens
            };

            return(Json(buscarViewModel));
        }
예제 #3
0
        public IHttpActionResult ObterPodcast()
        {
            List <AudioViewModel> audios = AudiosService.ObterAudios();

            return(Json(audios));
        }
예제 #4
0
        public IHttpActionResult ObterAudios()
        {
            var audios = AudiosService.ObterAudios();

            return(Json(audios));
        }