Пример #1
0
        public ActionResult Index(string id_news)
        {
            News        n    = new News();
            List <News> News = new List <News>();
            int         id;

            int.TryParse(id_news, out id);

            if (id != 0)
            {
                NewsVM nvm;
                Admin  a;

                n = _newsBLL.NewSelect(id);
                a = _adminBLL.SelectByNick(n.Author);

                nvm = new NewsVM(n, a);

                return(View("News", nvm));
            }
            else
            {
                if (id_news != null)
                {
                    News = _newsBLL.NewsListBySubTitle(id_news);
                }
                else
                {
                    News = _newsBLL.NewsList();
                }

                foreach (News news in News)
                {
                    news.NewsType = _rssFeed.DefineType(news.Text, news.Title);
                }

                return(View("index", News));
            }
        }
        //
        // GET: /Home/
        public ActionResult Index()
        {
            int views = 9;

            List <ChampsVM> champs = ConvertListModeltoVM(_champBLL.ChampionshipListHome(views));
            List <News>     news   = _newsBLL.NewsList();
            //List<Stream> stream = _minerStream.MineHome(views);
            List <FanArt>    fanarts   = _fanArtBLL.FanArtListHome(views);
            List <Spotlight> spotlight = _spotlightBLL.SpotlightList();

            foreach (News _news in news)
            {
                _news.NewsType = _rssFeed.DefineType(_news.Text, _news.Title);
            }

            List <News> newsHot     = new List <News>();
            List <News> newsLOL     = new List <News>();
            List <News> newsCS      = new List <News>();
            List <News> newsCBLOL   = new List <News>();
            List <News> newsESports = new List <News>();
            List <News> newsDOTA    = new List <News>();
            List <News> newsOW      = new List <News>();

            #region Gambi
            for (int i = 0; i < 3; i++)
            {
                newsHot.Add(news[i]);
                news.Remove(news[i]);
            }

            for (int i = 0; i < news.Count; i++)
            {
                if (news[i].NewsType == "League of Legends")
                {
                    newsLOL.Add(news[i]);
                }
                if (newsLOL.Count >= 3)
                {
                    break;
                }
            }

            for (int i = 0; i < news.Count; i++)
            {
                if (news[i].NewsType == "E-Sports")
                {
                    newsESports.Add(news[i]);
                }
                if (newsESports.Count >= 3)
                {
                    break;
                }
            }

            for (int i = 0; i < news.Count; i++)
            {
                if (news[i].NewsType == "Counter Strike")
                {
                    newsCS.Add(news[i]);
                }
                if (newsCS.Count >= 3)
                {
                    break;
                }
            }

            for (int i = 0; i < news.Count; i++)
            {
                if (news[i].NewsType == "CBLOL")
                {
                    newsCBLOL.Add(news[i]);
                }
                if (newsCBLOL.Count >= 3)
                {
                    break;
                }
            }

            for (int i = 0; i < news.Count; i++)
            {
                if (news[i].NewsType == "DOTA")
                {
                    newsDOTA.Add(news[i]);
                }
                if (newsDOTA.Count >= 3)
                {
                    break;
                }
            }

            for (int i = 0; i < news.Count; i++)
            {
                if (news[i].NewsType == "Overwatch")
                {
                    newsOW.Add(news[i]);
                }
                if (newsOW.Count >= 3)
                {
                    break;
                }
            }

            #endregion

            HomeVM hvm = new HomeVM(champs, newsHot, newsLOL, newsESports, newsCS, newsOW, newsDOTA, newsCBLOL, spotlight);

            //_rssFeed.FindPerWords();

            return(View(hvm));
        }