private DestaqueComTags GetDestaquesComtags(Section section, Home home, ref List <int> notInList) { if (!section.Editorialid.HasValue) { return(null); } var objEditorial = Editorial.Load(section.Editorialid.Value); var lstHighlights = Noticia.GetBySection(5, section, (home.Status || Section.SuaRegiao.Id == section.Id) ? home.Id : 1, ref notInList, true).ToList(); var objDestaqueComTags = new DestaqueComTags { Key = section.Key, Theme = section.Theme, Titulo = section.Desc, LinkTitulo = section.Url, LinkImgTitulo = objEditorial.IconUrl, Highlights = lstHighlights, Tags = NoticiaSrv.GetTagsBySection(section.Id, home.Id).ToList(), isLazy = !(section.Id == 1) //1 = sua região }; return(objDestaqueComTags); }
public ActionResult Index(int p = 1) { var objCidade = Cidade.Load(GetMyLocationId); var objModel = new VideoIndex { Title = "Vídeos - Massa News", Description = "Assista todos os Vídeos no Massa News.", Robots = "index, follow", Canonical = $"{Constants.UrlWeb}/videos", ImgOpenGraph = $"{Constants.UrlWeb}/content/images/avatar/editorial/avatar-videos.jpg", Highlights = Noticia.GetBySection(objCidade.Microregion.Home.Id, Section.Videos.Id).Take(3).Select(VideoModel.Map), RegionHighlights = GetRegionHighlights(objCidade.MicroregiaoId), SportsHighlights = GetSportsHighlights(), EntertainmentHighlights = GetEntertainmentHighlights(), NegociosDaTerraHighlights = GetNegociosDaTerraHighlights(), BlogsHighlights = GetBlogHighlights(), LiveOnHighlights = GetLiveOnHighlights(), DescobrindoCuritibaHighlights = GetDescobrindoCuritibaHighlights() }; //ViewBag's ViewBag.IsVideo = true; ViewBag.ActiveNav = "Vídeos"; ViewBag.EditoriaUrl = "videos"; return(View(objModel)); }
private CategoriasDestaquesModel GetCategoriaDestaquesModel(int homeId, ref List <int> notInList) { const int take = 2; var model = new CategoriasDestaquesModel { HighlightsEducacao = Noticia.GetBySection(take, Section.Educacao, homeId, ref notInList, true).ToList(), HighlightsBrasil = Noticia.GetBySection(take, Section.Brasil, homeId, ref notInList, true).ToList(), HighlightsMundo = Noticia.GetBySection(take, Section.Mundo, homeId, ref notInList, true).ToList(), HighlightsPolitica = Noticia.GetBySection(take, Section.Politica, homeId, ref notInList, true).ToList(), HighlightsEconomia = Noticia.GetBySection(take, Section.Economia, homeId, ref notInList, true).ToList(), HighlightsConcursosEmpregos = Noticia.GetBySection(take, Section.ConcursosEmpregos, homeId, ref notInList, true).ToList() //HighlightsMaisNoticias = Noticia.GetBySection(take, Section.MaisNoticias, homeId, ref notInList, true).ToList() }; return(model); }
private HomeIndex GetHomeIndexModel(int locationId) { var cacheSrv = new RedisCacheService(); //Get the city var city = Cidade.Load(locationId); //Get the home object var objHome = city.Microregion.Home; #region GET CACHE //Set the const time value const int time = 1; //Set the cache key var key = $"Home:{objHome.Id}"; //Find in the cache for the model var objModel = cacheSrv.Get <HomeIndex>(key); //If model exists in cache return the object if (objModel != null) { return(objModel); } #endregion //Save the current home state var currentHome = objHome; //If Home is disabled load the main home if (!objHome.Status) { objHome = Home.Load(1); //Home Curitiba } //Get list of news highlights var lstHighlights = Noticia.GetHighlightNewsByHome(objHome.Id).ToList(); //Create initial negation list with hiloghts id's var notInList = lstHighlights.Select(s => s.Id).ToList(); objModel = new HomeIndex { //Base Title = "Massa News - A notícia em movimento!", Description = "O Massa News oferece a melhor cobertura jornalística do Paraná com notícias personalizadas da sua região.", Robots = "index, follow", Canonical = Constants.UrlWeb, //Model Cidade = Cidade.Load(12), //Curitiba //objCidade, SidebarHighlight = objHome.SidebarHighlight, TemplateId = objHome.Highlight.TemplateId, Highlights = lstHighlights }; //SUA REGIÃO //Este módulo recebe a cidade original objModel.DestaqueComTagsSuaRegiao = GetDestaquesComtags(Section.SuaRegiao, currentHome, ref notInList); //ESPORTES objModel.DestaqueComTagsEsportes = GetDestaquesComtags(Section.Esportes, currentHome, ref notInList); //ENTRETEDIMENTO objModel.DestaqueComTagsEntretedimento = GetDestaquesComtags(Section.Entretenimento, currentHome, ref notInList); //PARANÁ - TODOS OS PLANTÕES objModel.DestaqueComTagsParana = GetDestaquesComtags(Section.Parana, currentHome, ref notInList); //CATEGORIAS DESTAQUES objModel.CategoriasDestaquesModel = GetCategoriaDestaquesModel(objHome.Id, ref notInList); //VIAJAR É MASSA objModel.DestaqueComTagsViajarEMassa = GetDestaquesComtags(Section.ViajarEMassa, currentHome, ref notInList); //WHERE CURITIBA if (currentHome.Id == 1) { objModel.DestaqueComTagsWhereCuritiba = GetDestaquesComtags(Section.WhereCuritiba, currentHome, ref notInList); } //NEGÓCIOS DA TERRA objModel.DestaqueComTagsNegociosDaTerra = GetDestaquesComtags(Section.NegociosDaTerra, currentHome, ref notInList); //VIDEOS objModel.DestaqueVideo = GetVideoHighlights(city, ref notInList); //FOTOS (GALERIAS) objModel.HighlightsFotos = Noticia.GetBySection(8, Section.Fotos, 1, ref notInList, true).ToList(); //BLOGS objModel.Blogs = GetBlogListByMicroregion(currentHome.MicroregiaoId); #region ENQUETE var statusEnquete = EnqueteSrv.GetStatusEnquete(); switch (statusEnquete.Status) { case (int)EnqueteEnum.Estadual: objModel.ShowEnquete = true; objModel.EnqueteId = Constants.EnqueteRegionalId; break; case (int)EnqueteEnum.Regional: foreach (var item in statusEnquete.RegioesEnquetes.Where(item => objHome.MicroregiaoId == item.MicroregiaoId && item.Status)) { objModel.ShowEnquete = true; objModel.EnqueteId = item.EnqueteId; } break; default: objModel.ShowEnquete = false; break; } #endregion //Set the cache cacheSrv.Set(key, objModel, time); return(objModel); }