コード例 #1
0
ファイル: HomeController.cs プロジェクト: jetelain/Arma3Event
        public async Task <IActionResult> Index()
        {
            var vm = new HomeViewModel();

            vm.User = await GetUser();

            var maxDate = DateTime.Today;

            if (vm.User != null)
            {
                vm.Matchs = await _context.Matchs.Where(m => m.StartDate >= maxDate).OrderBy(m => m.StartDate).Include(m => m.MatchTechnicalInfos).Include(m => m.Rounds).Include(m => m.Users).ToListAsync();
            }
            else
            {
                vm.Matchs = await _context.Matchs.Where(m => m.StartDate >= maxDate).OrderBy(m => m.StartDate).Include(m => m.Rounds).ToListAsync();
            }
            vm.News = await _context.News.OrderByDescending(n => n.Date).FirstOrDefaultAsync();

            vm.Videos = await _context.Videos.OrderByDescending(n => n.Date).Take(3).ToListAsync();


            vm.NextMatch = vm.Matchs.FirstOrDefault();
            if (vm.NextMatch != null && vm.NextMatch.TacMapId != null)
            {
                vm.NextMatch.TacMap = await _tacMaps.Get(vm.NextMatch.TacMapId.Value);
            }
            return(View(vm));
        }
コード例 #2
0
        private async Task LoadTacMap(Match match)
        {
            match.MapInfos = await _mapInfos.GetMapsInfos(match.WorldName);

            if (match.TacMapId != null)
            {
                match.TacMap = await _tacMaps.Get(match.TacMapId.Value);
            }
        }
コード例 #3
0
        private async Task <string[]> CreateAdditionalLinks(Match match)
        {
            if (match.TacMapId != null)
            {
                var tacMap = await _tacMaps.Get(match.TacMapId.Value);

                if (tacMap != null)
                {
                    return(new[] { tacMap.ReadOnlyHref });
                }
            }
            return(null);
        }