Example #1
0
        public ActionResult PodcastsFeed(string type, int?n)
        {
            if (!string.IsNullOrEmpty(type) && type.ToLower().Equals("rss"))
            {
                int totalItems = n.HasValue == false || n.Value <= 0 ? 50 : n.Value;

                NPartyArticlesHelper helper = new NPartyArticlesHelper();

                List <Article> npartyPodcasts     = helper.GetArticlesFromBlog(MainBlogId, "Podcasts", totalItems, 0, "N-Party Costa a Costa", "/NPartyCostaACosta/Ouvir/");
                List <Article> nintendoa3Articles = helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", totalItems, 0, "Nintendo a 3", "/Artigos/Ler/");

                List <Article> articles = new List <Article>();
                articles.AddRange(npartyPodcasts);
                articles.AddRange(nintendoa3Articles);

                List <Article> orderedArticles = articles.OrderByDescending(t => t.DatePublished).ToList();

                var items = new List <SyndicationItem>();

                var feed = new SyndicationFeed("N-Party", "Coloque seus fones de ouvidos e escute uma galera falando o que pensa sobre games e tudo mais!", new Uri("http://nparty.com.br/Feed/PodcastsFeed"));

                foreach (Article article in orderedArticles)
                {
                    SyndicationItem item = new SyndicationItem(
                        article.Title,
                        article.Content,
                        new Uri("http://nparty.com.br/" + article.NPartyArticleLink),
                        article.Id,
                        article.DatePublished);


                    item.PublishDate = article.DatePublished;

                    items.Add(item);
                }

                feed.Items    = items;
                feed.Language = "pt-br";

                return(new RssActionResult()
                {
                    Feed = feed
                });
            }
            else
            {
                return(Redirect("~/"));
            }
        }
Example #2
0
        public ActionResult SiteFeed(string type, int?n)
        {
            if (!string.IsNullOrEmpty(type) && type.ToLower().Equals("rss"))
            {
                int totalItems = n.HasValue == false || n.Value <= 0 ? 50 : n.Value;

                NPartyArticlesHelper helper = new NPartyArticlesHelper();

                List <Article> nintendoArticles = helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", totalItems, "/Artigos/Ler/");
                List <Article> esportsArticles  = helper.GetArticlesFromBlog(ESportsBlogId, "ESports", totalItems, "/Artigos/Ler/");
                List <Article> eventosArticles  = helper.GetArticlesFromBlog(EventosBlogId, "Eventos", totalItems, "/Artigos/Ler/");
                List <Article> npartyPodcasts   = helper.GetArticlesFromBlog(MainBlogId, "Podcasts", totalItems, 0, "N-Party Costa a Costa", "/NPartyCostaACosta/Ouvir/");

                List <Article> articles = new List <Article>();
                articles.AddRange(nintendoArticles);
                articles.AddRange(esportsArticles);
                articles.AddRange(eventosArticles);
                articles.AddRange(npartyPodcasts);

                List <Article> orderedArticles = articles.OrderByDescending(t => t.DatePublished).ToList();

                var items = new List <SyndicationItem>();

                var feed = new SyndicationFeed("N-Party", "O melhor do mundo da Nintendo, eSports e Eventos com a N-Party", new Uri("http://nparty.com.br/Feed/SiteFeed"));

                foreach (Article article in orderedArticles)
                {
                    items.Add(new SyndicationItem(
                                  article.Title,
                                  article.Summary,
                                  new Uri("http://nparty.com.br/" + article.NPartyArticleLink),
                                  article.Id,
                                  article.DatePublished
                                  ));
                }

                feed.Items = items;

                return(new RssActionResult()
                {
                    Feed = feed
                });
            }
            else
            {
                return(Redirect("~/"));
            }
        }
Example #3
0
        public JsonResult PodcastFeedOnHome()
        {
            NPartyArticlesHelper helper = new NPartyArticlesHelper();

            Dictionary <string, string> blogDomains = new Dictionary <string, string>();

            blogDomains.Add(NintendoBlogId, "Nintendo");
            blogDomains.Add(ESportsBlogId, "NParty");

            List <Article> nintendoPodcasts = helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", 4, 0, "Nintendo a 3", "/Artigos/Ler/");
            List <Article> npartyPodcasts   = helper.GetArticlesFromBlog(MainBlogId, "Podcasts", 4, 0, "N-Party Costa a Costa", "/NPartyCostaACosta/Ouvir/");

            List <Article> podcastFeed = new List <Article>();

            podcastFeed.AddRange(nintendoPodcasts);
            podcastFeed.AddRange(npartyPodcasts);

            return(Json(podcastFeed.OrderByDescending(t => t.DatePublished).Take(4).ToList(), JsonRequestBehavior.AllowGet));
        }
Example #4
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            NPartyArticlesHelper helper = new NPartyArticlesHelper();

            Dictionary <string, string> blogDomains = new Dictionary <string, string>();

            blogDomains.Add(NintendoBlogId, "Nintendo");
            blogDomains.Add(ESportsBlogId, "ESports");
            blogDomains.Add(EventosBlogId, "Eventos");

            List <Article> hilights         = helper.GetHomeHilights(blogDomains, MainBlogId);
            List <Article> nintendoArticles = helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", 4, "/Artigos/Ler/");
            List <Article> esportsArticles  = helper.GetArticlesFromBlog(ESportsBlogId, "ESports", 4, "/Artigos/Ler/");
            List <Article> eventosArticles  = helper.GetArticlesFromBlog(EventosBlogId, "Eventos", 4, "/Artigos/Ler/");

            ViewData["Hilights"]      = hilights;
            ViewData["NintendoPosts"] = nintendoArticles;
            ViewData["eSportsPosts"]  = esportsArticles;
            ViewData["EventosPosts"]  = eventosArticles;

            return(View());
        }
Example #5
0
        public ActionResult NintendoFeed(string type, int?n)
        {
            if (!string.IsNullOrEmpty(type) && type.ToLower().Equals("rss"))
            {
                int totalItems = n.HasValue == false || n.Value <= 0 ? 50 : n.Value;

                NPartyArticlesHelper helper = new NPartyArticlesHelper();

                List <Article> nintendoArticles = helper.GetArticlesFromBlog(NintendoBlogId, "Nintendo", totalItems, "/Artigos/Ler/");

                var items = new List <SyndicationItem>();

                var feed = new SyndicationFeed("Nintendo N-Party", "O melhor do mundo da Nintendo com a N-Party. Wii U, 3DS, Preview, Review, Notícias, Pokémon, Zelda, Mario e mais", new Uri("http://nparty.com.br/Feed/NintendoFeed"));

                foreach (Article article in nintendoArticles)
                {
                    items.Add(new SyndicationItem(
                                  article.Title,
                                  article.Summary,
                                  new Uri("http://nparty.com.br/" + article.NPartyArticleLink),
                                  article.Id,
                                  article.DatePublished
                                  ));
                }

                feed.Items = items;

                return(new RssActionResult()
                {
                    Feed = feed
                });
            }
            else
            {
                return(Redirect("~/"));
            }
        }
Example #6
0
        public ActionResult EventosFeed(string type, int?n)
        {
            if (!string.IsNullOrEmpty(type) && type.ToLower().Equals("rss"))
            {
                int totalItems = n.HasValue == false || n.Value <= 0 ? 50 : n.Value;

                NPartyArticlesHelper helper = new NPartyArticlesHelper();

                List <Article> eventosArticles = helper.GetArticlesFromBlog(EventosBlogId, "Eventos", totalItems, "/Artigos/Ler/");

                var items = new List <SyndicationItem>();

                var feed = new SyndicationFeed("Eventos N-Party", "O melhor do mundo do eSports com a N-Party. League of Legends, Counter Strike, Dicas e mais", new Uri("http://nparty.com.br/Feed/EventosFeed"));

                foreach (Article article in eventosArticles)
                {
                    items.Add(new SyndicationItem(
                                  article.Title,
                                  article.Summary,
                                  new Uri("http://nparty.com.br/" + article.NPartyArticleLink),
                                  article.Id,
                                  article.DatePublished
                                  ));
                }

                feed.Items = items;

                return(new RssActionResult()
                {
                    Feed = feed
                });
            }
            else
            {
                return(Redirect("~/"));
            }
        }