Esempio n. 1
0
        public NewsItemViewModel(Noticia objNews, ControllerContext context)
        {
            NoticiaSrv = new NoticiaService();

            objNews.Conteudo = Replace(objNews, context);

            News = objNews;
            Tags = objNews.Tags.Where(t => t.Status).OrderBy(t => t.Titulo).ToList();

            var microregiaoId = News.CidadeId.HasValue ? NoticiaSrv.GetMicroregiaoIdByCidade(News.CidadeId.Value) : (int?)null;

            if (objNews.DestaqueId == Destaque.Video.Id)
            {
                NewsVideosRelacionados = NoticiaSrv.GetNewsVideosRelacionados(objNews.Id, objNews.CategoriaId, objNews.EditorialId, microregiaoId).ToList();
            }

            //Get Autors
            Autors = objNews.GetAutors();

            //Set the tag news
            Tags.ForEach(t => t.Noticias = Noticia.GetKnowMoreNewsByTagCached(t.Id).Where(n => n.Id != objNews.Id).Take(3));
        }