예제 #1
0
        public IActionResult Index(IList <string> errors)
        {
            UpdatePlayersFromApi();
            var model = new VMIndex
            {
                WaitingList = _squadService.QueryWaitingPlayers(_context),
                Squads      = _context.Squads.Include(s => s.Players).ToList(),
                SquadsExist = _context.Squads.Any(),
                Errors      = errors
            };

            return(View(model));
        }
예제 #2
0
        public IActionResult Index()
        {
            PostTransform pt      = new PostTransform();
            VMIndex       vmIndex = new VMIndex();

            foreach (var post in _context.GetOrderdTop10())
            {
                vmIndex.Poster.Add(pt.Transform(post));
            }
            foreach (var rubrik in _context.Get().OrderByDescending(p => p.Datum))
            {
                vmIndex.Rubriker.Add(new VMPostlistaItem()
                {
                    Id = rubrik.Id, Rubrik = rubrik.Rubrik
                });
            }

            return(View(vmIndex));
        }
예제 #3
0
        public VMIndex Fetch()
        {
            DAL         db             = new DAL();
            var         justPublished  = db.Blogs.Where(m => m.BlogStatus == 1).Take(6).OrderByDescending(m => m.CreationTime).ToList();
            var         hotTopicBlogId = db.GetBlogStatusCount.OrderByDescending(m => m.CommentsCount).Select(m => m.BlogId).First();
            var         hotTopic       = db.Blogs.FirstOrDefault(m => m.BlogId == hotTopicBlogId);
            var         trendingBlogId = db.GetBlogStatusCount.OrderByDescending(m => m.LikesCount).Select(m => m.BlogId).Take(5).ToList();
            List <Blog> trending       = new List <Blog>();

            foreach (var item in trendingBlogId)
            {
                var topic = db.Blogs.FirstOrDefault(m => m.BlogId == item && m.BlogStatus == 1);
                trending.Add(topic);
            }
            var data = new VMIndex()
            {
                LatestTopic   = justPublished,
                HotTopic      = hotTopic,
                TrendingTopic = trending
            };

            return(data);
        }