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)); } }
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)); }
public IHttpActionResult ObterPodcast() { List <AudioViewModel> audios = AudiosService.ObterAudios(); return(Json(audios)); }
public IHttpActionResult ObterAudios() { var audios = AudiosService.ObterAudios(); return(Json(audios)); }