public ActionResult Parana(int p = 1)
        {
            //if the page is lower than 0 will return a 404 error
            if (p <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var model = Service.Models.Noticia.GetLastestNewsInParanaByPage(p);

            ViewBag.Pagina       = "parana";
            ViewBag.ActiveNav    = "Paraná";
            ViewBag.UrlPaginacao = "/noticias/parana";

            if (model.TotalPages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(model.TotalPages), 5, true);
            }

            //Recupera as 4 ultimas notícias que são exibidas na sidebar
            ViewBag.Lastest4News = Service.Models.Noticia.GetLastestNews(4).ToList();

            //Recuper as 5 ultimas notícias mais acessadas
            ViewBag.Popular5News = Service.Models.Noticia.GetMoreAccessedNews(1); //editorial 1 = Noticias

            return(View("Parana", model));
        }
Example #2
0
        public ActionResult LandBCK(int p = 1)
        {
            //get the tag
            var tagUrl = "planejamento-de-vida";

            //get the tag
            var objTag = Tag.GetByUrl(tagUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Planejamento de Vida - BCK Corretora de Seguros",
                Description  = "Quer saber mais sobre Seguros? Confira aqui!",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/planejamento-de-vida",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/bck/avatar.png"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            //Set viewbag's
            ViewBag.ActiveNav = "Planejamento de Vida";

            // Página
            ViewBag.Pagina = "planejamento-de-vida";

            //return the model to the view
            return(View(model));
        }
Example #3
0
        public ActionResult ViajePelosCamposGerais(int p = 1)
        {
            //get the tag
            var tagUrl = "viaje-pelos-campos-gerais";

            //get the tag
            var objTag = Tag.GetByUrl(tagUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Viaje pelos Campos Gerais - Massa News",
                Description  = "Histórias, Cultura, Gastronomia e Diversão. Tudo isso bem pertinho de você. Viaje pelos Campos Gerais.",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/viaje-pelos-campos-gerais",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/viaje-pelos-campos-gerais/avatar.png"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            //Set viewbag's
            ViewBag.ActiveNav = "Viaje pelos Campos Gerais";

            // Página
            ViewBag.Pagina = "viaje-pelos-campos-gerais";

            //return the model to the view
            return(View(model));
        }
Example #4
0
        public ActionResult FarolDoSaberEInovacao(int p = 1)
        {
            //get the tag
            var tagUrl = "farol-do-saber-e-inovacao";

            //get the tag
            var objTag = Tag.GetByUrl(tagUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Farol do Saber e Inovação - Massa News",
                Description  = "Farol do Saber e Inovação. Confira!",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/farol-do-saber-e-inovacao",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/farol-do-saber-e-inovacao/avatar.png"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            //Set viewbag's
            ViewBag.ActiveNav = "Farol do Saber e Inovação";

            // Página
            ViewBag.Pagina = "farol-do-saber-e-inovacao";

            //return the model to the view
            return(View(model));
        }
        public ActionResult Foto(int p = 1)
        {
            /* verificação da página */
            if (p <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var model = new CategoriaModel();

            ViewBag.ActiveNav = "Fotos";

            /* Paginação */
            model.Noticias =
                Db.Noticias.Where(
                    n =>
                    n.StatusId == Status.Publicada.Id && n.DestaqueId == Destaque.Galeria.Id &&
                    n.Galerias.Any(ga => ga.Imagens.Any()) && !string.IsNullOrEmpty(n.ImgSm))
                .OrderByDescending(n => n.DataPublicacao)
                .Skip((p - 1) * Constants.TakeNoticias)
                .Take(Constants.TakeNoticias)
                .ToList();

            ViewBag.PaginaAtual    = p;
            ViewBag.TotalRegistros =
                Db.Noticias.Count(
                    n =>
                    n.StatusId == Status.Publicada.Id && n.DestaqueId == Destaque.Galeria.Id &&
                    n.Galerias.Any(ga => ga.Imagens.Any()) && !string.IsNullOrEmpty(n.ImgSm));

            var totalPaginas = Math.Ceiling(((double)ViewBag.TotalRegistros / Constants.TakeNoticias));

            if (Convert.ToInt32(totalPaginas) > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(ViewBag.PaginaAtual, Convert.ToInt32(totalPaginas), 5, true);
            }

            //Recupera as 4 ultimas notícias que são exibidas na sidebar
            ViewBag.Lastest4News = Service.Models.Noticia.GetLastestNews(4).ToList();

            //Recuper as 5 ultimas notícias mais acessadas
            ViewBag.Popular5News = Service.Models.Noticia.GetMoreAccessedNews(null);

            /* base model defaults */
            model.Title       = $"{"Fotos"} - Massa News";
            model.Description = $"Veja todas as {"Fotos"} no Massa News.";
            model.Robots      = "index, follow";
            model.Canonical   = $"{Constants.UrlWeb}/fotos";

            return(View("Foto", model));
        }
Example #6
0
        public ActionResult FestivalGastronomico(int p = 1)
        {
            //get the tag
            var tagUrl = "festival-gastronomico";

            //get the tag
            var objTag = Tag.GetByUrl(tagUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Festival Gastronômico - 3ª Edição - Massa News",
                Description  = "O Festival Gastronômico está em sua 3ª Edição para promover mais uma vez o que há de melhor na gastronomia iguaçuense e da região.",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/festival-gastronomico",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/festival-gastronomico/avatar.jpg"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            //Vídeos
            // var sectionTransmitaCalor = new DestaqueVideoViewModel.VideoSection{
            //   Url = "festival-gastronomico",
            //   Title = "festival-gastronomico",
            //   Videos = NoticiaSrv.GetLastestVideoNewsByTag(4, 796).Select(VideoModel.Map),
            //   ButtonText = "Ver todos os vídeos",
            //   ButtonUrl = "/videos"
            // };

            // var objModel = new DestaqueVideoViewModel
            // {
            //   Titulo = "Vídeos",
            //   Url = "https://www.youtube.com/user/redemassa?sub_confirmation=1",
            //   Sections = { sectionTransmitaCalor }
            // };

            // model.DestaqueVideo = objModel;

            //Set viewbag's
            ViewBag.ActiveNav = "Festival Gastronômico";

            // Página
            ViewBag.Pagina = "festival-gastronomico";

            //return the model to the view
            return(View(model));
        }
Example #7
0
        public ActionResult EducacaoFinanceira(int p = 1)
        {
            //get the tag
            var tagUrl = "educacao-financeira";

            //get the tag
            var objTag = Tag.GetByUrl(tagUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Educação Financeira - Massa News",
                Description  = "Educação Financeira. Realização: Sicredi",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/educacao-financeira",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/educacao-financeira/avatar.png"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            //Vídeos
            var sectionEducacaoFinanceira = new DestaqueVideoViewModel.VideoSection
            {
                Url        = "educacao-financeira",
                Title      = "educacao-financeira",
                Videos     = NoticiaSrv.GetLastestVideoNewsByTag(4, 794).Select(VideoModel.Map),
                ButtonText = "Ver todos os vídeos",
                ButtonUrl  = "/videos"
            };

            var objModel = new DestaqueVideoViewModel
            {
                Titulo   = "Vídeos",
                Url      = "https://www.youtube.com/playlist?list=PLIsicGjQ0iOvxJoseEwr3_66qxHOng4aq",
                Sections = { sectionEducacaoFinanceira }
            };

            model.DestaqueVideo = objModel;

            //Set viewbag's
            ViewBag.ActiveNav = "Educação Financeira";

            // Página
            ViewBag.Pagina = "educacao-financeira";

            //return the model to the view
            return(View(model));
        }
Example #8
0
        public ActionResult MassaNaRussia(int p = 1)
        {
            //get the tag
            var tagUrl       = "massa-news-na-russia";
            var tagModuleUrl = "especial-russia";

            //get the tag
            var objTag       = Tag.GetByUrl(tagUrl);
            var objTagModule = Tag.GetByUrl(tagModuleUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Massa na Rússia - Tudo sobre o maior evento de Futebol do Mundo!",
                Description  = "Notícias, Tabela de Jogos, Classificação, Bolão e muito mais do maior evento de Futebol do Mundo. Confira!",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/narussia",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/massa-na-russia/avatar.png"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();

                // 1) LINE NEWS
                model.LineNews = objTagModule.GetLastestNews(p - 1, 4, null, true).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            // // 2) VÍDEOS
            // var sectionVideos = new DestaqueVideoViewModel.VideoSection
            // {
            //   //Videos = NoticiaSrv.GetLastestVideoNewsByTag(4, 797).Select(VideoModel.Map),
            //   Videos = NoticiaSrv.GetLastestVideoNewsByTag(4, 794).Select(VideoModel.Map)
            // };

            // var objModel = new DestaqueVideoViewModel
            // {
            //   Titulo = "Direto da Rússia",
            //   //Url = "",
            //   Sections = { sectionVideos }
            // };

            // model.DestaqueVideo = objModel;

            // Tables
            ViewBag.LstClassificacao = CampeonatoSrv.GetHtmlClassificacaoCopaDoMundo();
            ViewBag.LstRodadas       = CampeonatoSrv.GetListRodadas((int)CampeonatoEnum.CopaDoMundo);

            //Set viewbag's
            ViewBag.ActiveNav = "Massa na Rússia";

            // Página
            ViewBag.Pagina = "massa-na-russia";

            //return the model to the view
            return(View(model));
        }
Example #9
0
        public ActionResult DesafiandoChefs(int p = 1)
        {
            //get the tag
            var tagUrl = "desafiando-chefs";

            //get the tag
            var objTag = Tag.GetByUrl(tagUrl);

            //Init the model
            var model = new LandViewModel()
            {
                Title        = "Desafiando Chefs - Temporada Damasco",
                Description  = "O Grupo Massa e a Damasco desafiam chefs renomados para um desafio de dar água na boca! Eles terão que provar suas habilidades fazendo receitas incríveis com uma condição, utilizar Café Damasco em uma websérie exclusiva e deliciosa!",
                Robots       = "index, follow",
                Canonical    = $"{Constants.UrlWeb}/desafiando-chefs",
                ImgOpenGraph = $"{Constants.UrlWeb}/content/images/landing/desafiando-chefs/avatar.png"
            };

            //Set the news
            if (p == 1)
            {
                model.Highlights = objTag.GetLastestNews(p - 1, 5, null, true).ToList();
                model.NewsList   = objTag.GetNewsList(p - 1, 20, model.Highlights.Select(s => s.Id).ToList()).ToList();
            }
            else
            {
                model.Highlights = null;
                model.NewsList   = objTag.GetNewsList(p - 1, 20, null).ToList();
            }

            //Get the news count
            var nRowsCount = model.NewsList.Any() ? model.NewsList.First().Total : 0;

            //get the number of pages
            var pages = Convert.ToInt32(Math.Ceiling(((double)nRowsCount / 20)));

            //Add pagination if has more than one page
            if (pages > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(p, Convert.ToInt32(pages), 5, true);
            }

            //Vídeos
            var sectionDesafiandoChefs = new DestaqueVideoViewModel.VideoSection
            {
                Url        = "desafiando-chefs",
                Title      = "desafiando-chefs",
                Videos     = NoticiaSrv.GetLastestVideoNewsByTag(4, 759).Select(VideoModel.Map),
                ButtonText = "Ver todos os vídeos",
                ButtonUrl  = "/videos"
            };

            var objModel = new DestaqueVideoViewModel
            {
                Titulo   = "Vídeos",
                Sections = { sectionDesafiandoChefs }
            };

            model.DestaqueVideo = objModel;

            //Set viewbag's
            ViewBag.ActiveNav = "Desafiando Chefs";

            // Página
            ViewBag.Pagina = "desafiando-chefs";

            //return the model to the view
            return(View(model));
        }
Example #10
0
        public ActionResult BlogPosts(string categoria, string blog, int p = 1)
        {
            if (categoria == null || blog == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            var objBlog = Db.Blogs.FirstOrDefault(b => b.Url == blog);

            if (objBlog == null)
            {
                var    slugBlogNotFound = $"/blogs/{categoria}/{blog}/posts";
                string urlDestino       = UrlRedirect.GetByUrl(slugBlogNotFound);

                if (!string.IsNullOrEmpty(urlDestino))
                {
                    return(new RedirectResult($"{urlDestino}"));
                }
                else
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                }
            }

            if (objBlog.Categoria.Url != categoria)
            {
                return(new RedirectResult($"/blogs/{objBlog.Categoria.Url}/{objBlog.Url}/posts/", true));
            }

            ViewBag.TotalRegistros = objBlog.Noticias.Count;

            //Get the list of blog autors
            var lstAutors = Autor.GetAllByBlogId(objBlog.Id).ToList();

            //Set the path in the images
            lstAutors.ForEach(a => a.Avatar = $"{Constants.UrlDominioEstaticoUploads}/{"autores"}/{a.Avatar}");

            var model = new BlogPostViewModel
            {
                Blog   = objBlog,
                Autors = lstAutors
            };

            var lstNoticiasHighlights = GetNoticiasByBlogHighlight(objBlog.CategoriaId, objBlog.Id);

            var noticias = objBlog.Noticias.Where(post => post.StatusId == Status.Publicada.Id)
                           .OrderByDescending(b => b.DataPublicacao)
                           .Skip((p - 1) * Constants.TakeNoticias)
                           .Take(Constants.TakeNoticias)
                           .ToList();


            if (p == 1)
            {
                model.NoticiasHighlights = lstNoticiasHighlights?.Select(Service.Models.Noticia.Map).ToList();
            }


            model.Blog.Noticias = noticias.Where(n => !lstNoticiasHighlights.Any(n2 => n2.Id == n.Id)).ToList();



            //Paginação
            ViewBag.PaginaAtual = p;

            var totalPaginas = Math.Ceiling(((double)ViewBag.TotalRegistros / Constants.TakeNoticias));

            if (Convert.ToInt32(totalPaginas) > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(ViewBag.PaginaAtual, Convert.ToInt32(totalPaginas), 5, true);
            }

            //base model defaults
            model.Title        = $"Blog {objBlog.Titulo} - Massa News";
            model.Description  = $"{objBlog.Descricao} Confira o Blog {objBlog.Titulo}!";
            model.Robots       = "index, follow";
            model.Canonical    = $"{Constants.UrlWeb}/blogs/{categoria}/{blog}/posts";
            model.ImgOpenGraph = $"{Constants.UrlWeb}/content/images/avatar/blogs/{blog}.jpg";

            ViewBag.ActiveNav = objBlog.Titulo;

            // Página
            ViewBag.Pagina = "blog";

            // Editoria
            ViewBag.EditoriaUrl = "blogs";

            // Categoria
            ViewBag.Categoria = model.Blog.Categoria.Url;

            // Blog
            ViewBag.Blog = model.Blog.Url;

            return(View(model));
        }
Example #11
0
        public ActionResult Index(string filtro = null, string o = "relevancia", string q = null, int p = 1)
        {
            /* verificação da página */
            if (p <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            if (q == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            /* "cooka" o usuário com as palavras utilizadas */

            q = q.TrimEnd();

            SetKeywords(q);

            var resultados = new List <SearchResponse>();

            var oBusca = new SearchService();

            /* noticias */
            var lstNoticias = oBusca.Search(Constants.ElasticIndexName, q, p, Constants.TakeNoticias, 0.6);

            resultados.AddRange(lstNoticias);

            /* counts do menu */
            var model = new BuscaModel
            {
                Count         = resultados.Count,
                CountNoticias = resultados.Count(),
            };

            /* aplica filtro de tipo */
            if (filtro == null)
            {
                resultados             = resultados.ToList();
                ViewBag.TotalRegistros = model.Count;
            }
            else if (filtro == "noticias")
            {
                resultados             = resultados.ToList();
                ViewBag.TotalRegistros = model.CountNoticias;
            }

            //Ordena por data
            model.Resultados = resultados.OrderByDescending(r => r.Data).Skip((p - 1) * Constants.TakeNoticias).Take(Constants.TakeNoticias).ToList();

            ViewBag.PaginaAtual = p;

            var totalPaginas = Math.Ceiling(((double)ViewBag.TotalRegistros / Constants.TakeNoticias));

            if (Convert.ToInt32(totalPaginas) > 1)
            {
                ViewBag.Paginacao = Pagination.AddPagination(ViewBag.PaginaAtual, Convert.ToInt32(totalPaginas), 5, true);
            }

            ViewBag.ActiveNav   = "Resultado da busca";
            ViewBag.SearchWords = q;
            ViewBag.Filter      = filtro;
            ViewBag.Order       = o;

            model.Title       = string.Format("Resultado da busca por {0} - Massa News", q);
            model.Description = string.Format("Confira todos os resultados da busca por {0}. Notícias, posts, fotos, vídeos e muito mais no Massa News.", q);
            model.Robots      = "index, follow";

            return(View(model));
        }